~fgaz/builds.sr.ht

189cebe60b1135c7bb80324309c1ae3166244751 — Simon Ser 2 years ago 7f1998a
worker: add -config flag

Useful when invoking "go run" from the parent dir, e.g. so that
the worker can access the local images/ dir.
1 files changed, 4 insertions(+), 1 deletions(-)

M worker/main.go
M worker/main.go => worker/main.go +4 -1
@@ 28,12 28,15 @@ var (
)

func main() {
	var configPath string
	flag.IntVar(&workers, "workers", runtime.NumCPU(),
		"configure number of workers")
	flag.StringVar(&configPath, "config", "../config.ini",
		"path to config.ini file")
	flag.Parse()

	var err error
	for _, path := range []string{"../config.ini", "/etc/sr.ht/config.ini"} {
	for _, path := range []string{configPath, "/etc/sr.ht/config.ini"} {
		config, err = ini.LoadFile(path)
		if err == nil {
			break