Working with hydra config files
Hydra config files, not to be confused with hydra-cli’s configuration settings, are used by services when they initialize hydra or hydra-express.
Those config files are commonly loaded at runtime and their contents are passed to Hydra.
During startup, if Hydra see’s the HYDRA_REDIS_URL and the HYDRA_SERVICE environment variables then Hydra will ask the specified Redis instance for a copy of its config file.
The environment variables should be defined this way:
This is commonly used when hydra-enabled applications are used in Docker containers.
Hydra-cli offers the cfg command for listing, loading and uploading configuration file data to Redis.
You can retrieve a list of configs using:
$ hydra-cli cfg list myservice
To store a config you’d have to specify the service name separated by a colon and the service version.
$ hydra-cli cfg pull myservice:0.12.1
Using the cfg pull command above the retrieved config would be displayed in the terminal. To save the pulled config to a file you can direct it using:
$ hydra-cli cfg pull myservice:0.12.1 > config.json
To upload a config you can use the cfg push command:
$ hydra-cli cfg push myservice:0.12.2 config.json
Listing configs, retrieving one and saving it to a file — then later modifying it prior to uploading it is how you manage your service’s configs.