mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-23 12:38:21 -05:00
make config dir configurable
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -31,14 +31,23 @@ var (
|
||||
func DefaultConfigSources(filename string, drivers []string) []string {
|
||||
var sources []string
|
||||
|
||||
for i := range defaultLocations {
|
||||
dirFS := os.DirFS(defaultLocations[i])
|
||||
locations := []string{}
|
||||
if os.Getenv("OCIS_CONFIG_DIR") != "" {
|
||||
// only use the configured config dir
|
||||
locations = append(locations, os.Getenv("OCIS_CONFIG_DIR"))
|
||||
} else {
|
||||
// merge config from all default locations
|
||||
locations = append(locations, defaultLocations...)
|
||||
}
|
||||
|
||||
for i := range locations {
|
||||
dirFS := os.DirFS(locations[i])
|
||||
pattern := filename + ".*"
|
||||
matched, _ := fs.Glob(dirFS, pattern)
|
||||
if len(matched) > 0 {
|
||||
// prepend path to results
|
||||
for j := 0; j < len(matched); j++ {
|
||||
matched[j] = filepath.Join(defaultLocations[i], matched[j])
|
||||
matched[j] = filepath.Join(locations[i], matched[j])
|
||||
}
|
||||
}
|
||||
sources = append(sources, matched...)
|
||||
|
||||
Reference in New Issue
Block a user