-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
34 lines (26 loc) · 854 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
"log"
"github.com/kontena/pharos-host-upgrades/hosts"
)
func loadConfig(options Options) (hosts.Config, error) {
var config hosts.Config
if path := options.ConfigPath; path == "" {
} else if exists, err := config.UsePath(path); err != nil {
return config, fmt.Errorf("Invalid --config-path=%v: %v", path, err)
} else if !exists {
log.Printf("Skipping non-existing --config-path=%v", path)
} else {
log.Printf("Load config from --config-path=%v", path)
}
if path := options.HostMount; path == "" {
} else if exists, err := config.UseMount(path); err != nil {
return config, fmt.Errorf("Invalid --host-mount=%v: %v", path, err)
} else if !exists {
log.Printf("Skipping non-existing --host-mount=%v", path)
} else {
log.Printf("Copying configs to --host-mount=%v", path)
}
return config, nil
}