An alternative to Air that just does the one thing Air should be doing. No hugo. No forced upgrades to random Go version. Just run processes and restart on builds.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ozai/config/settings.go

39 lines
601 B

package config
import (
"flag"
"log"
"os"
"io"
"encoding/json"
)
type command struct {
Command string
}
type config struct {
Processes map[string]command
ConfigPath string
}
var Settings config
func parseFlags(c *config) {
flag.StringVar(&c.ConfigPath, "config", ".ozai.json", ".ozai.json to load")
flag.Parse()
}
func Load() {
parseFlags(&Settings)
fh, err := os.Open(Settings.ConfigPath)
if err != nil { log.Fatal(err) }
data, err := io.ReadAll(fh)
if err != nil { log.Fatal(err) }
err = json.Unmarshal(data, &Settings)
if err != nil { log.Fatal(err) }
}