[skip ci] Added description on how to add new config option

This commit is contained in:
kolaente 2019-02-09 14:12:22 +01:00
parent 88f5fe2d87
commit fa481b4da9
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,21 @@
# Adding new config options
where, how to use them etc.
Vikunja uses [viper](https://github.com/spf13/viper) to handle configuration options.
It handles parsing all different configuration sources.
The configuration is done in sections. These are represented with a `.` in viper.
Take a look at `pkg/config/config.go` to understand how these are set.
To add a new config option, you should add a default value to `pkg/config/config.go`.
Default values should always enable the feature to work somehow, or turn it off completely if it always needs
additional configuration.
Make sure to add the new config option to [the config document](../setup/config.md) and the default config file
(`config.yml.sample` at the root of the repository) to make sure it is well documented.
If you're using a computed value as a default, make sure to update the sample config file and debian
post-install scripts to reflect that.
To get a configured option, use `viper.Get("config.option")`.
Take a look at [viper's documentation](https://github.com/spf13/viper#getting-values-from-viper) to learn of the
different ways available to get config options.