Skip to content

Commit

Permalink
main: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed May 29, 2024
1 parent 9f69b2a commit 5c6c55f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,16 @@ func main() {
// options parsing.
//
// See https://github.com/AdguardTeam/dnsproxy/issues/182.
if len(arg) > 13 {
if arg[:13] == "--config-path" {
fmt.Printf("Path: %s\n", arg[14:])
b, err := os.ReadFile(arg[14:])
if err != nil {
log.Fatalf("failed to read the config file %s: %v", arg[14:], err)
}
err = yaml.Unmarshal(b, options)
if err != nil {
log.Fatalf("failed to unmarshal the config file %s: %v", arg[14:], err)
}
if len(arg) > 13 && arg[:13] == "--config-path" {
fmt.Printf("dnsproxy config path: %s\n", arg[14:])
b, err := os.ReadFile(arg[14:])
if err != nil {
log.Fatalf("failed to read the config file %s: %v", arg[14:], err)
}

err = yaml.Unmarshal(b, options)
if err != nil {
log.Fatalf("failed to unmarshal the config file %s: %v", arg[14:], err)
}
}
}
Expand Down

0 comments on commit 5c6c55f

Please sign in to comment.