From 08cbd18bc52095aae6e30eacbd311171c2ebace6 Mon Sep 17 00:00:00 2001 From: konrad Date: Sun, 20 Jan 2019 17:13:21 +0000 Subject: [PATCH] Added more config paths (#55) --- docs/config.md | 9 +++++++++ pkg/config/config.go | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/config.md b/docs/config.md index 81760ca06ea..fff192bb249 100644 --- a/docs/config.md +++ b/docs/config.md @@ -17,6 +17,15 @@ first: child: true ``` +## Config file locations + +Vikunja will search on various places for a config file: + +* Next to the location of the binary +* In the `service.rootpath` location set in a config (remember you can set config arguments via environment variables) +* In `/etc/vikunja` +* In `~/.config/vikunja` + # Default configuration with explanations This is the same as the `config.yml.sample` file you'll find in the root of vikunja. diff --git a/pkg/config/config.go b/pkg/config/config.go index e1ab0ab9da4..4bcaed277b7 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -84,8 +84,9 @@ func init() { viper.AutomaticEnv() // Load the config file - viper.AddConfigPath(exPath) viper.AddConfigPath(viper.GetString("service.rootpath")) + viper.AddConfigPath("/etc/vikunja/") + viper.AddConfigPath("~/.config/vikunja") viper.AddConfigPath(".") viper.SetConfigName("config") err = viper.ReadInConfig()