added cli flag for specifying config
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
- Deployment(PKGBUILD, bootstrap script?)
|
- Deployment(PKGBUILD, bootstrap script?)
|
||||||
- More complete sync(refresh packages on schedule with db, prefetch updates to pkgs we already have)
|
- More complete sync(refresh packages on schedule with db, prefetch updates to pkgs we already have)
|
||||||
- Build server/tool
|
- Build server/tool
|
||||||
|
- ~flag for loading non default config~
|
||||||
- ~Deployment(systemd, systemd.timer)~
|
- ~Deployment(systemd, systemd.timer)~
|
||||||
- ~Basic testing for internal/cache~
|
- ~Basic testing for internal/cache~
|
||||||
- ~basic file server that fulfills pacman api~
|
- ~basic file server that fulfills pacman api~
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@@ -13,7 +14,16 @@ type Server struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg, err := ReadConfig("/etc/pkgstash/pkgstash.toml")
|
|
||||||
|
// set config from flag if available
|
||||||
|
var configPath string
|
||||||
|
flag.StringVar(&configPath, "config", "", "path to config file")
|
||||||
|
flag.Parse()
|
||||||
|
if len(configPath) == 0 {
|
||||||
|
configPath = "/etc/pkgstash/pkgstash.toml"
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg, err := ReadConfig(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user