server auth

This commit is contained in:
2026-05-28 08:35:50 -04:00
parent 3d44a392f1
commit fc63f9c44a
37 changed files with 3877 additions and 74 deletions

View File

@@ -12,6 +12,7 @@ type Config struct {
Database DatabaseConfig `json:"database"`
Content ContentConfig `json:"content"`
Web WebConfig `json:"web"`
Auth AuthConfig `json:"auth"`
LogLevel string `json:"logLevel"`
}
@@ -35,6 +36,10 @@ type WebConfig struct {
DevViteURL string `json:"devViteUrl"`
}
type AuthConfig struct {
PublicOrigin string `json:"publicOrigin"`
}
func Default() Config {
return Config{
Server: ServerConfig{
@@ -51,6 +56,9 @@ func Default() Config {
DistDir: filepath.Join("..", "web", "dist"),
DevViteURL: os.Getenv("CAIRNQUIRE_DEV_VITE_URL"),
},
Auth: AuthConfig{
PublicOrigin: "http://localhost:8080",
},
LogLevel: "INFO",
}
}
@@ -72,6 +80,7 @@ func Load() (Config, error) {
overrideString(&cfg.Content.StoreDir, "CAIRNQUIRE_CONTENT_STORE_DIR")
overrideString(&cfg.Web.DistDir, "CAIRNQUIRE_WEB_DIST_DIR")
overrideString(&cfg.Web.DevViteURL, "CAIRNQUIRE_DEV_VITE_URL")
overrideString(&cfg.Auth.PublicOrigin, "CAIRNQUIRE_PUBLIC_ORIGIN")
overrideString(&cfg.LogLevel, "CAIRNQUIRE_LOG_LEVEL")
if cfg.Server.Addr == "" {