module
Amber::Configuration
Defined in:
amber/configuration/app_config.cramber/configuration/custom_registry.cr
amber/configuration/database_config.cr
amber/configuration/env_override.cr
amber/configuration/jobs_config.cr
amber/configuration/logging_config.cr
amber/configuration/mailer_config.cr
amber/configuration/pubsub_config.cr
amber/configuration/server_config.cr
amber/configuration/session_config.cr
amber/configuration/static_config.cr
Class Method Summary
-
.custom_config_defaults : Hash(String, YAML::Serializable)
Returns all registered custom config keys and their default instances.
-
.load_custom_from_yaml(key : String, yaml_content : String) : YAML::Serializable | Nil
Load a custom config from a YAML node, or return the default instance if no YAML node is provided.
-
.register_custom(key : String, default_instance : YAML::Serializable) : Nil
Runtime registration method called by the
registermacro.
Macro Summary
-
register(key, config_type)
Register a custom configuration type with the Amber settings system.
Class Method Detail
Returns all registered custom config keys and their default instances.
Load a custom config from a YAML node, or return the default instance if no YAML node is provided.
Runtime registration method called by the register macro.
Macro Detail
macro register(key, config_type)
#
Register a custom configuration type with the Amber settings system.
After registration, the config can be loaded from YAML files under
the given key and accessed via Amber.settings.custom(:key, Type).
Example
struct MyAppConfig
include YAML::Serializable
property api_key : String = ""
def initialize
end
end
Amber::Configuration.register(:my_app, MyAppConfig)