Skip to content

Commit aad8e56

Browse files
committed
feat: add executable's directory as config path
1 parent 8446f9b commit aad8e56

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package lib
33
import (
44
"errors"
55
"fmt"
6+
"os"
67
"path/filepath"
78
"strings"
89

@@ -53,6 +54,10 @@ func ParseConfig(filename string, flags *pflag.FlagSet) (*Config, error) {
5354
// Configuration file settings
5455
v.AddConfigPath(".")
5556
v.AddConfigPath("/etc/webdav/")
57+
if path, err := os.Executable(); err == nil {
58+
v.AddConfigPath(filepath.Dir(path))
59+
}
60+
5661
v.SetConfigName("config")
5762
if filename != "" {
5863
v.SetConfigFile(filename)

0 commit comments

Comments
 (0)