class Amber::Configuration::AppConfig

Included Modules

Defined in:

amber/configuration/app_config.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new #

[View source]

Instance Method Detail

def custom(key : Symbol, type : T.class) : T forall T #

Retrieve a registered custom configuration section by key and type.

Example

stripe = Amber.settings.custom(:stripe, MyApp::StripeConfig)
stripe.api_key # => "sk_test_..."

The section is deserialized as type on each call, so keep the result rather than calling this per request. When the YAML has no such section, the default instance given to Amber::Configuration.register is returned.


[View source]
def custom_configs : Hash(String, String) #

Custom configuration sections loaded at runtime, as the raw YAML of each section keyed by section name. Storing YAML rather than YAML::Serializable instances keeps Amber from deserializing through the union of every YAML::Serializable type in the program; that union includes application models (Grant models among them), and their YAML constructors may not compile.


[View source]
def custom_configs=(custom_configs : Hash(String, String)) #

Custom configuration sections loaded at runtime, as the raw YAML of each section keyed by section name. Storing YAML rather than YAML::Serializable instances keeps Amber from deserializing through the union of every YAML::Serializable type in the program; that union includes application models (Grant models among them), and their YAML constructors may not compile.


[View source]
def database : DatabaseConfig #

[View source]
def database=(database : DatabaseConfig) #

[View source]
def jobs : JobsConfig #

[View source]
def jobs=(jobs : JobsConfig) #

[View source]
def logging : LoggingConfig #

[View source]
def logging=(logging : LoggingConfig) #

[View source]
def mailer : MailerConfig #

[View source]
def mailer=(mailer : MailerConfig) #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def params : ParamsConfig #

[View source]
def params=(params : ParamsConfig) #

[View source]
def pubsub : PubSubConfig #

[View source]
def pubsub=(pubsub : PubSubConfig) #

[View source]
def secrets : Hash(String, String) #

[View source]
def secrets=(secrets : Hash(String, String)) #

[View source]
def server : ServerConfig #

[View source]
def server=(server : ServerConfig) #

[View source]
def session : SessionConfig #

[View source]
def session=(session : SessionConfig) #

[View source]
def static : StaticConfig #

[View source]
def static=(static : StaticConfig) #

[View source]
def validate!(environment : Amber::Environment::Env | Nil = nil) : Nil #

Run validation on all subsystem configurations. Collects all errors and raises a single ConfigurationError if any are found.


[View source]