module Amber::Configuration

Defined in:

amber/configuration/app_config.cr
amber/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

Macro Summary

Class Method Detail

def self.custom_config_defaults : Hash(String, YAML::Serializable) #

Returns all registered custom config keys and their default instances.


[View source]
def self.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.


[View source]
def self.register_custom(key : String, default_instance : YAML::Serializable) : Nil #

Runtime registration method called by the register macro.


[View source]

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)

[View source]