Migrate config to mcdsl: Load[T], env overrides, embedded types

Replace local TOML loading with mcdsl/config.Load[Config] which adds
METACRYPT_ environment variable overrides. ServerConfig and MCIASConfig
now embed their mcdsl counterparts, extending with ExternalURL and
ServiceToken respectively. DatabaseConfig and LogConfig replaced with
mcdsl types directly.

TOML structure is preserved — no config file changes needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 14:09:58 -07:00
parent d887ca30ca
commit 2a927e5359
4 changed files with 79 additions and 63 deletions

View File

@@ -16,6 +16,9 @@ import (
"git.wntrmute.dev/kyle/metacrypt/internal/barrier"
"git.wntrmute.dev/kyle/metacrypt/internal/config"
"git.wntrmute.dev/kyle/metacrypt/internal/crypto"
mcdslauth "git.wntrmute.dev/kyle/mcdsl/auth"
mcdslconfig "git.wntrmute.dev/kyle/mcdsl/config"
"git.wntrmute.dev/kyle/metacrypt/internal/db"
"git.wntrmute.dev/kyle/metacrypt/internal/engine"
"git.wntrmute.dev/kyle/metacrypt/internal/policy"
@@ -46,12 +49,14 @@ func setupTestServer(t *testing.T) (*Server, *seal.Manager, chi.Router) {
cfg := &config.Config{
Server: config.ServerConfig{
ListenAddr: ":0",
TLSCert: "cert.pem",
TLSKey: "key.pem",
ServerConfig: mcdslconfig.ServerConfig{
ListenAddr: ":0",
TLSCert: "cert.pem",
TLSKey: "key.pem",
},
},
Database: config.DatabaseConfig{Path: filepath.Join(dir, "test.db")},
MCIAS: config.MCIASConfig{ServerURL: "https://mcias.test"},
Database: mcdslconfig.DatabaseConfig{Path: filepath.Join(dir, "test.db")},
MCIAS: config.MCIASConfig{Config: mcdslauth.Config{ServerURL: "https://mcias.test"}},
Seal: config.SealConfig{
Argon2Time: 1,
Argon2Memory: 64 * 1024,