Skip to main content
Version: Next

Config Store API

ConfigStore is a singleton storing configs in memory. The primary API for interacting with the ConfigStore is the store method described below.

API#

class ConfigStore(metaclass=Singleton):    def store(        self,        name: str,        node: Any,        group: Optional[str] = None,        package: Optional[str] = "_group_",        provider: Optional[str] = None,    ) -> None:        """        Stores a config node into the repository        :param name: config name        :param node: config node, can be DictConfig, ListConfig,            Structured configs and even dict and list        :param group: config group, subgroup separator is '/',            for example hydra/launcher        :param package: Config node parent hierarchy.            Child separator is '.', for example foo.bar.baz        :param provider: the name of the module/app providing this config.            Helps debugging.        """    ...

Example node values#

A few examples of supported node values parameters:

@dataclassclass MySQLConfig:    host: str = "localhost"    port: int = 3306
# Using the typecs.store(name="config1", node=MySQLConfig)# Using an instance, overriding some default valuescs.store(name="config2", node=MySQLConfig(host="test.db", port=3307))# Using a dictionary, forfeiting runtime type safetycs.store(name="config3", node={"host": "localhost", "port": 3308})