expand relative path ~/.config/vikunja to $HOME/.config/vikunja **WINDOWS** (#147)

apply correct formatting

add quotes to make the yaml gods happy

log path of config file used by viper

resolve merge conflicts: windows compatible $HOME path

Prepare changelog & readme for 0.11 release

expand relative path ~/.config/vikunja to $HOME/.config/vikunja (#146)

update dependencies

expand relative path ~/.config/vikunja

Co-authored-by: Julian <juliangaal@protonmail.com>
Co-authored-by: konrad <konrad@kola-entertainments.de>

Co-authored-by: Julian Gaal <gjulian@uos.de>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/147
Reviewed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
funkythings 2020-03-20 21:21:44 +00:00 committed by konrad
parent 5126330a10
commit 51c74de1de
3 changed files with 17 additions and 8 deletions

View file

@ -77,7 +77,7 @@ cors:
enable: true enable: true
# A list of origins which may access the api. # A list of origins which may access the api.
origins: origins:
- * - "*"
# How long (in seconds) the results of a preflight request can be cached. # How long (in seconds) the results of a preflight request can be cached.
maxage: 0 maxage: 0

3
go.mod
View file

@ -40,7 +40,6 @@ require (
github.com/go-testfixtures/testfixtures/v3 v3.1.1 github.com/go-testfixtures/testfixtures/v3 v3.1.1
github.com/go-xorm/core v0.6.2 // indirect github.com/go-xorm/core v0.6.2 // indirect
github.com/go-xorm/xorm v0.7.9 // indirect github.com/go-xorm/xorm v0.7.9 // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.3.2 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc
github.com/imdario/mergo v0.3.7 github.com/imdario/mergo v0.3.7
@ -56,8 +55,6 @@ require (
github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/olekukonko/tablewriter v0.0.1 github.com/olekukonko/tablewriter v0.0.1
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/pelletier/go-toml v1.4.0 // indirect github.com/pelletier/go-toml v1.4.0 // indirect
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829

View file

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@ -250,14 +251,25 @@ func InitConfig() {
// Load the config file // Load the config file
viper.AddConfigPath(ServiceRootpath.GetString()) viper.AddConfigPath(ServiceRootpath.GetString())
viper.AddConfigPath("/etc/vikunja/") viper.AddConfigPath("/etc/vikunja/")
viper.AddConfigPath("$HOME/.config/vikunja")
viper.AddConfigPath(".") homeDir, err := os.UserHomeDir()
viper.SetConfigName("config")
err := viper.ReadInConfig()
if err != nil { if err != nil {
log.Println(err.Error()) log.Println(err.Error())
log.Println("Using defaults.") log.Println("Using defaults.")
return
} }
viper.AddConfigPath(path.Join(homeDir, ".config", "vikunja"))
viper.AddConfigPath(".")
viper.SetConfigName("config")
err = viper.ReadInConfig()
if err != nil {
log.Println(err.Error())
log.Println("Using defaults.")
return
}
log.Println("Found config file:", viper.ConfigFileUsed())
} }
func random(length int) (string, error) { func random(length int) (string, error) {