added ability to use custom config file (#587)
This commit is contained in:
1 parent
91f40b1f02
commit
a9cb7156a3
2 files changed
+17
-3
No files matched your search
@@ -174,9 +174,17 @@ func (app *app) loop() {
|
||||
}()
|
||||
}
|
||||
|
||||
for _, path := range gConfigPaths {
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
app.readFile(path)
|
||||
if gCustomConfig != "" {
|
||||
if _, err := os.Stat(gCustomConfig); !os.IsNotExist(err) {
|
||||
app.readFile(gCustomConfig)
|
||||
} else {
|
||||
log.Printf("Config file does not exist: %s", err)
|
||||
}
|
||||
} else {
|
||||
for _, path := range gConfigPaths {
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
app.readFile(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ var (
|
||||
gLogPath string
|
||||
gServerLogPath string
|
||||
gSelect string
|
||||
gCustomConfig string
|
||||
gCommands arrayFlag
|
||||
gVersion string
|
||||
)
|
||||
@@ -217,6 +218,11 @@ func main() {
|
||||
"",
|
||||
"path to the file to write selected files on open (to use as open file dialog)")
|
||||
|
||||
flag.StringVar(&gCustomConfig,
|
||||
"config",
|
||||
"",
|
||||
"path to a custom config file to be used, instead of normal lfrc file")
|
||||
|
||||
flag.Var(&gCommands,
|
||||
"command",
|
||||
"command to execute on client initialization")
|
||||
|
||||
Reference in new issue
Block a user