Internal APIs:

All public functions of the Gila class are available in the singleton instance with the addition of gila.reset(), which will reset the singleton instance back to empty.

class Gila

An instance of the Gila config store

add_config_path(filepath: str)

Adds a filepath to the list of filepaths to search for config files The filepath can be either an absolute path or a path relative to the current working directory


filepathstr: The filepath to be added


Returns a dictionary representing all of the current config values with the overrides in place.


Tells Gila to automatically load env vars that start with the env_prefix, if set.

bind_env(key: str, env_key: str = None)

Binds a given key to an environemnt variable. Default usage with bind_env(key) would bind the config value key with the environment value KEY. If an env_key is passed in, it will be used instead of the default uppercased key. eg bind_env(key, env_key) will bind the config value of key to ENV_KEY.

NOTE: If env_key is not passed in, the key will be merged with a given prefix, should one exist.

  • keystr: Key to bind to

  • env_keystr: (Default value = None) Optional env key to bind the config key to. If not present, fallback will be key.upper()


Prints all of the instance internal dictionaries for debugging purposes

deregister_alias(alias: str)

Removes an alias for a key in the config store.


aliasstr: Alias to remove from config store

get(key: str)

This fetches a value from the config store for a given key. Returns None if no value is found.

The order of precedence on get is: overrides > environment variables > config vars > default values.


keystr: The key to search the config store for

in_config(key: str)

Checks if a given key is found in the config file provided. Returns false if no file has been loaded in yet


keystr: key to check in config values

is_set(key: str)

Checks if a given key is in the config store.


keystr: Key to check

override(key: str, value: Any)

Sets the override value for a given key. Override values will take precedence over all other found values of a given key

  • keystr: The key in the config store

  • value – Any: The override value to be set for the key

override_with_env(prefix: str)

Finds all env vars with given prefix and sets them as overrides with a lowercase key. This would allow for a one-time load of environment vars to the config store. The loaded env vars will be loaded in as overrides, meaning they will take precedence over all other values


prefixstr: The prefix for Gila to use while searching.


Will read in config from file. Gila will iterate through the given filepaths, and return the first file found in a config path that has the extension that is set with gila.set_config_type() if it is set, or the first file with a supported filetype.

register_alias(alias: str, key: str)

Registers an alias for a given key. When a key has an alias, gila.Get(key) and gila.Get(alias) will return the same value

  • aliasstr: Alias to give key

  • keystr: Real key in the config store

remove_default(key: str)

Remove the default key.


keystr: The real key in the config store

remove_override(key: str)

Removes the override for a key, if it is currently set


keystr: They key to remove the override for


Resets all of the values in the singleton instance of Gila

set_config_file(filepath: str)

Sets the filepath to the intended config file. This is an increased level of verbosity than set_config_name and set_config_type, as if the config file is set, Gila will only look for the config file in that one location.


filepathstr: The filepath to the intended config file

set_config_name(filename: str)

Sets the filename that Gila will look for. If the filename is set and the config type is not, Gila will search for a config file with the given config name and any of the supported extensions


filenamestr: The name of the config file that Gila should look for

set_config_type(filetype: str)

Sets the file extension that gila should look for - if not set, gila will look for a file with any of the supported filetypes.


filetypestr: The extension of the config file that Gila should look for

set_default(key: str, value: Any)

Sets the default value for key to value. If no other values are found when running gila.get(key), the default value will be returned.

  • keystr: The real key in the config store

  • value – Any: The default value to be set for the key

set_env_prefix(prefix: str)

Sets the prefix that the automatic environment loader will use to find values for a given key. For instance, set_env_prefix(“prefix”) will set the prefix Gila is looking for to PREFIX_. This means that when gila.get(“key”) is ran and automatic_env is enabled, Gila will look for the value in PREFIX_KEY


prefixstr: The prefix to be added. This value will be uppercased and have “_” suffixed

unbind_env(key: str)

Removes a binding between an env_var and a key, if it exists