aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2022-01-27 12:05:15 +0000
committerr <r@freesoftwareextremist.com>2022-01-27 12:05:15 +0000
commitb8c0133bcd5e7f1d4063ad992949cc19d18e7aad (patch)
tree5322b83d194c9ffcb498627bdd16175f9508d87d /main.go
parent54c42455f393c5ae8ebdb19884d40ebd9a18f755 (diff)
parent4ef5e0daf285f41850c9ac53b0322d85fbf5eaec (diff)
downloadbloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.tar.gz
bloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.zip
Merge branch 'master' into absolute_fluoride
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/main.go b/main.go
index cac5eee..3b5ccba 100644
--- a/main.go
+++ b/main.go
@@ -2,6 +2,7 @@ package main
import (
"errors"
+ "flag"
"fmt"
"log"
"net/http"
@@ -17,7 +18,7 @@ import (
)
var (
- configFile = "/etc/bloat.conf"
+ configFiles = []string{"bloat.conf", "/etc/bloat.conf"}
)
func errExit(err error) {
@@ -26,19 +27,13 @@ func errExit(err error) {
}
func main() {
- opts, _, err := util.Getopts(os.Args, "f:")
- if err != nil {
- errExit(err)
- }
+ configFile := flag.String("f", "", "config file")
+ flag.Parse()
- for _, opt := range opts {
- switch opt.Option {
- case 'f':
- configFile = opt.Value
- }
+ if len(*configFile) > 0 {
+ configFiles = []string{*configFile}
}
-
- config, err := config.ParseFile(configFile)
+ config, err := config.ParseFiles(configFiles)
if err != nil {
errExit(err)
}