summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 7f5056c..3af0ef9 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -28,8 +28,8 @@ import (
var (
port = flag.Int("port", 42069, "port to listen on")
selfURL = flag.String("self-url", "http://localhost:42069", "base URL of the server")
- secretsFile = flag.String("secrets", "secrets.ini", "secrets file")
- configFile = flag.String("config", "config.ini", "configuration file (no spec or examples, sorry)")
+ secretsFile = flag.String("secrets", "secrets.ass", "secrets file")
+ configFile = flag.String("config", "config.ass", "configuration file (asspb format https://pkg.go.dev/roseh.moe/pkg/asspb)")
serverStartTime = time.Now()
)
@@ -95,21 +95,15 @@ func loadConfig() (*serviceConfiguration, error) {
return nil, err
}
var fileConfig struct {
- Redirect []struct{ Package, Command, Redirect string }
+ PackageRedirects map[string]string
+ CommandRedirects map[string]string
}
if err := asspb.Unmarshal(fileBytes, &fileConfig); err != nil {
return nil, err
}
config := &serviceConfiguration{
- packageRedirects: make(map[string]string),
- commandRedirects: make(map[string]string),
- }
- for _, redirect := range fileConfig.Redirect {
- if redirect.Package != "" {
- config.packageRedirects[redirect.Package] = redirect.Redirect
- } else {
- config.commandRedirects[redirect.Command] = redirect.Command
- }
+ packageRedirects: fileConfig.PackageRedirects,
+ commandRedirects: fileConfig.CommandRedirects,
}
serviceConfigMu.Lock()
serviceConfig = config