mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-25 00:00:55 +01:00
Get the path to the config file from the command line
This commit is contained in:
parent
cefaa1c3a6
commit
32a8a3d3e2
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
@ -37,8 +38,10 @@ type ServerConfig struct {
|
||||
}
|
||||
|
||||
func ConfigLoad(proxy *Proxy, config_file string) error {
|
||||
configFile := flag.String("config", "/etc/dnscrypt-proxy/dnscrypt-proxy.toml", "path to the configuration file")
|
||||
flag.Parse()
|
||||
config := newConfig()
|
||||
if _, err := toml.DecodeFile(config_file, &config); err != nil {
|
||||
if _, err := toml.DecodeFile(*configFile, &config); err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user