diff --git a/assets/config/openlore.yml b/assets/config/openlore.yml deleted file mode 100644 index 49f4e5f..0000000 --- a/assets/config/openlore.yml +++ /dev/null @@ -1,67 +0,0 @@ -version: "1" - -# Capture unsupported shell usage so production traffic can drive command and -# syntax gap analysis. These events are emitted only at debug level. -debug: true - -port: 2222 -# external_ssh_port: 22 # set only when a load balancer remaps `port` -http_port: 8080 -metrics_port: 0 -default_cwd: / - -auth_file: ./config/lore.json -data_dir: ./data - -# Disk-backed lore is overlaid at the virtual root. Its directory hierarchy is -# the namespace; lore.json independently defines docsets and authorization. -writable_dir: ./published - -# Global write lock. The substrate boots read-only by default; set false to -# enable the experimental writable substrate so authenticated identities can -# create/overwrite files within their writable docsets (per-identity/per-docset -# scoping still applies on top of this). -readonly: false - -# How whole-file overwrites (>, tee, sed -i, publish) defend against concurrent -# writers. "hash" (the default) makes them compare-and-swap: a write that would -# clobber a change made since the file was read is rejected. "last_write_wins" -# makes overwrites unconditional. Append (>>) and patch are always CAS. Can be -# overridden per docset via write_conflict_policy in lore.json. -write_conflict_policy: hash - -# Max concurrent async `spawn` jobs. The `spawn` command (granted only to -# identities holding the "spawn" capability) runs an external command and writes -# its output back into the lore in a background goroutine; this bounds how many -# run at once. In-flight jobs are in-memory and lost on restart (drained briefly -# on shutdown). Default 8. -max_jobs: 8 - -mcp: - enabled: true - path: /mcp - require_auth: true - -passkeys: - enabled: true - rp_id: openlore.sh - rp_name: OpenLore - rp_origins: - - https://openlore.sh - lore_path: /lore - passkeys_file: ./config/passkeys.json - session_ttl: 24h - -# Bearer-token auth for the MCP + HTTP API. Server infrastructure (how this -# instance mints/verifies tokens), so it lives here, not in lore.json. Enabling -# it mounts the OAuth flow (/authorize, /oauth/token), Dynamic Client -# Registration (/register), and discovery (/.well-known/oauth-*), so OAuth-native -# MCP clients (Claude Desktop, Cowork) can log in. The mcp.require_auth setting -# governs both MCP-over-HTTP and the JSON API, overriding the default posture -# inherited from lore.json's allow_keyless. -# The ES256 signing key is generated on first boot under /auth/. -tokens: - issuer: https://openlore.sh - audience: https://openlore.sh - access_ttl: 1h - refresh_ttl: 720h diff --git a/assets/skills/setup.md b/assets/skills/setup.md index 4df86e8..c1a023e 100644 --- a/assets/skills/setup.md +++ b/assets/skills/setup.md @@ -431,8 +431,10 @@ architecture: 1. Clone OpenLore into a separate temporary directory and check out the selected release. -2. Remove that clone's embedded `assets/config/openlore.yml` before building, - because a binary cannot load embedded and external configuration together. +2. Run `rm -f assets/config/openlore.yml` in that clone before building to + remove any production fallback config shipped by older releases. Current + releases use built-in defaults; an external config file replaces any + custom embedded config. 3. Build the web UI first so the local server includes the dashboard like the published image: in the clone, run `npm --prefix dashboard ci` and `npm --prefix dashboard run build`. Without this step Go builds a binary diff --git a/cmd/openlore/main_test.go b/cmd/openlore/main_test.go index 74581ba..9ccdf28 100644 --- a/cmd/openlore/main_test.go +++ b/cmd/openlore/main_test.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "context" "crypto/ed25519" "encoding/json" "os" @@ -9,11 +10,38 @@ import ( "strings" "testing" + "github.com/aakarim/go-openlore/assets" "github.com/aakarim/go-openlore/internal/config" openlore "github.com/aakarim/go-openlore/pkg/openlore" gossh "golang.org/x/crypto/ssh" ) +func TestFreshInstallServer(t *testing.T) { + t.Chdir(t.TempDir()) + if err := os.Mkdir("docs", 0755); err != nil { + t.Fatal(err) + } + embedded, _ := assets.EmbeddedConfig() + srv, err := openlore.NewServer("docs", + openlore.WithConfigFile("./openlore.yml"), + openlore.WithEmbeddedConfig(embedded, assets.DefaultMOTD()), + ) + if err != nil { + t.Fatalf("fresh-install server: %v", err) + } + t.Cleanup(func() { _ = srv.Shutdown(context.Background()) }) + cfg := srv.Config() + if cfg.Port != 2222 || cfg.HTTPPort != 8080 || !cfg.MCPEnabled || cfg.MCPPath != "/mcp" { + t.Fatalf("unexpected listener defaults: SSH=%d HTTP=%d MCP=%t %q", cfg.Port, cfg.HTTPPort, cfg.MCPEnabled, cfg.MCPPath) + } + if cfg.AuthFile != "" || !cfg.AllowKeyless || (cfg.MCPRequireAuth != nil && *cfg.MCPRequireAuth) { + t.Fatalf("fresh install must allow anonymous reads without an auth file") + } + if !cfg.Readonly || cfg.WritableDir != "" || cfg.Tokens != nil || cfg.Passkeys.RPID == "openlore.sh" { + t.Fatal("fresh install inherited production write or authentication settings") + } +} + func policyFile(t *testing.T, auth config.AuthConfig) string { t.Helper() p := filepath.Join(t.TempDir(), "lore.json") diff --git a/railpack-plan.json b/railpack-plan.json index 5015c08..3319075 100644 --- a/railpack-plan.json +++ b/railpack-plan.json @@ -117,8 +117,8 @@ ], "commands": [ { - "cmd": "sh -c 'rm assets/config/openlore.yml'", - "customName": "rm assets/config/openlore.yml" + "cmd": "sh -c 'rm -f assets/config/openlore.yml'", + "customName": "rm -f assets/config/openlore.yml" }, { "cmd": "sh -c 'go build -o out ./cmd/openlore'", diff --git a/railpack.json b/railpack.json index 587eb40..ba10190 100644 --- a/railpack.json +++ b/railpack.json @@ -29,7 +29,7 @@ } ], "commands": [ - "rm assets/config/openlore.yml", + "rm -f assets/config/openlore.yml", "go build -o out ./cmd/openlore" ] }