From 29b666619b4d0c54602f14a37d267fb9115eae9c Mon Sep 17 00:00:00 2001 From: Joona Hoikkala Date: Wed, 16 Nov 2016 15:31:40 +0200 Subject: [PATCH] Refactoring --- config.go | 14 -------------- util.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 config.go diff --git a/config.go b/config.go deleted file mode 100644 index 463d12a..0000000 --- a/config.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "errors" - "github.com/BurntSushi/toml" -) - -func ReadConfig(fname string) (DnsConfig, error) { - var conf DnsConfig - if _, err := toml.DecodeFile(fname, &conf); err != nil { - return DnsConfig{}, errors.New("Malformed configuration file") - } - return conf, nil -} diff --git a/util.go b/util.go index 8fcc4b9..a2fda88 100644 --- a/util.go +++ b/util.go @@ -2,12 +2,22 @@ package main import ( "crypto/rand" + "errors" + "github.com/BurntSushi/toml" "github.com/satori/go.uuid" "math/big" "regexp" "strings" ) +func ReadConfig(fname string) (DnsConfig, error) { + var conf DnsConfig + if _, err := toml.DecodeFile(fname, &conf); err != nil { + return DnsConfig{}, errors.New("Malformed configuration file") + } + return conf, nil +} + func SanitizeString(s string) string { // URL safe base64 alphabet without padding as defined in ACME re, err := regexp.Compile("[^A-Za-z\\-\\_0-9]+")