Gestalt is a small library that does one thing: it moves configuration parameters such as database connection parameters or SSL keystore locations out of your Clojure code and into a configuration file that lives outside your source tree.
Gestalt is a small library that does one thing: it moves configuration parameters such as database connection parameters or SSL keystore locations out of your Clojure code and into a configuration file that lives outside your source tree.
The default config file. Can be overridden by setting the java property
gestalt.file, or by calling reset-gestalt! with the appropriate filename
The default config file. Can be overridden by setting the java property `gestalt.file`, or by calling `reset-gestalt!` with the appropriate filename
The default environment to use. Defaults to "development". This value
and the value of java property gestalt.environment are specified as strings, but
in the configuration file your environment keys should be keywords, e.g. :development.
The default environment to use. Defaults to "development". This value and the value of java property `gestalt.environment` are specified as strings, but in the configuration file your environment keys should be keywords, e.g. `:development`.
(defined? k)Returns true if and only if key k is defined in the configuration map.
Returns true if and only if key k is defined in the configuration map.
(environment)Returns the environment the application is running in.
Returns the environment the application is running in.
Name of the Java property to specify another config file
Name of the Java property to specify another config file
Name of Java property that determines the environment
Name of Java property that determines the environment
(get & ks)Returns the configuration value for keys ks.
Returns the configuration value for keys ks.
(reset-gestalt!)(reset-gestalt! file-or-reader)(reset-gestalt! file-or-reader env)Initialises the configuration system.
NB: this is called automatically when you first use call get or
environment, but you could call this function to specify a custom
location of the configuration file, or a custom environment.
When reset-gestalt! is called in the body of a with-scoped-config
call, the reset is only visible within body.
Initialises the configuration system. NB: this is called automatically when you first use call `get` or `environment`, but you could call this function to specify a custom location of the configuration file, or a custom environment. When `reset-gestalt!` is called in the body of a `with-scoped-config` call, the reset is only visible within body.
(with-config cfg & body)Temporarily sets the configuration to cfg and evaluates body
Temporarily sets the configuration to cfg and evaluates body
(with-environment env & body)Temporarily sets the environment to env and evaluates body.
Temporarily sets the environment to env and evaluates body.
(with-scoped-config & body)Creates a thread-bound scope for configuration and environment and
evaluates body. This will cause calls to reset-gestalt! to only
affect the config and environment in the scope of body; useful for
testing.
Creates a thread-bound scope for configuration and environment and evaluates body. This will cause calls to `reset-gestalt!` to only affect the config and environment in the scope of body; useful for testing.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |