Class: Snails::Application

Inherits:
Object show all
Defined in:
runtime/snails/application.rb,
runtime/snails/application.rbs

Overview

App-owned settings read through Snails.app.<name>. Values only — no adapters, no side effects; config/environment.rb owns environment-dependent wiring. An app declares its settings by reopening this class in config/application.rb; these defaults stand in when it declares none.

Instance Method Summary collapse

Instance Method Details

#app_name ⇒ String

the app's own name; the server announces itself with it.

The default is generic so a tree whose config/application.rb declares none still starts with a usable name.

Returns:

  • (String) —

    the app's name, "app" when the app declares none



28
# File 'runtime/snails/application.rb', line 28

def app_name: () -> String

#revision ⇒ String?

the deployment identifier of the app code.

ENV["REVISION"] wins, then a REVISION file at the app root. The value is memoized because it describes this process's deployment, not a request-derived value. There is no git fallback: a native binary may run where the repository is absent, so a deploy sets the env or writes the file.

Returns:

  • (String, nil) —

    the revision, nil when neither source exists



81
# File 'runtime/snails/application.rb', line 81

def revision: () -> String?

#secret_key_base ⇒ String

the standard read channel for the app's signing key. The source is the deployment's SECRET_KEY_BASE; a missing or empty value raises here, because a token signed with a guessable key validates for anyone who guesses it.

The runtime neither generates nor stores a key. An app that sources its key differently (a secret manager, for example) reopens Application and overrides this reader.

Returns:

  • (String) —

    the deployment-provided signing key

Raises:

  • (ArgumentError) —

    when SECRET_KEY_BASE is unset or empty



43
# File 'runtime/snails/application.rb', line 43

def secret_key_base: () -> String

#time_zone ⇒ String

the process zone every local time is presented in, as an IANA identifier. Read-only: config/environment.rb owns the slot with Snails.time_zone = "<zone>", which resolves and validates the name.

Returns:

  • (String) —

    the IANA identifier



56
# File 'runtime/snails/application.rb', line 56

def time_zone: () -> String

#version ⇒ String?

the app's own version, when it declares one.

There is no default: the framework version and the app version are different facts, so an app that wants one reopens this class in config/application.rb and answers it here. nil means "not declared" and a log record omits the field rather than inventing a value.

Returns:

  • (String, nil) —

    the app version, nil when the app declares none



68
# File 'runtime/snails/application.rb', line 68

def version: () -> String?