Commit 24184b1
feat: replace ENV with YAML config (#1755)
* wip: initial commit
* refactor(config): move compass.yaml to repo root and use typed config directly
* refactor(self-host): inline web build config and simplify installer
* fix(e2e): write playwright compass config at config-load time
The e2e webServer (dev.ts) now calls loadCompassConfig() instead of
reading process.env directly. Write a minimal .playwright-compass.yaml
at playwright.config.ts import time and pass its path via
COMPASS_CONFIG_FILE so the webServer finds it without a compass.yaml in
the repo root.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(config): correct ENV_FILE → CONFIG_FILE and tighten timezone schema
Two bugs caught in code review:
1. validate_existing_env_secrets() guarded on \$ENV_FILE which was
removed in the env-to-yaml migration. The guard always returned early,
silently skipping all secret placeholder checks on re-installs.
Changed to \$CONFIG_FILE.
2. CompassConfigSchema accepted any string for runtime.timezone but the
backend EnvSchema enforced z.enum(["Etc/UTC","UTC"]). The mismatch
produced a confusing TZ enum error at backend startup instead of a
clear parse error at YAML load time. Moved the enum constraint into
the shared schema so both web and backend catch it early.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(e2e): include ports section in playwright test config
dev.ts reads WEB_PORT from config.ports?.web (falls back to 9080),
so the test compass.yaml must declare ports.web to match the port
Playwright waits on.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(scripts): replace getCliConfig() with module-level cliConfig
Load and parse compass.yaml once at module init instead of re-reading
the file on every call. Callers now access typed fields directly
(cliConfig.urls.backendApi, etc.). DEV_BROWSER remains a plain
process.env read since it is not part of the config schema.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(ci): build staging compass.yaml from individual secrets/vars
Replaces the COMPASS_YAML blob secret with granular GitHub vars
(non-sensitive URLs, client IDs) and secrets (credentials, tokens).
The printf pattern mirrors Dockerfile.web — each field is a separate
auditable/rotatable value.
* fix(deploy): correct environment variable assignments for staging deployment
* docs: remove migration note from local-development.md
The .env.local → compass.yaml migration steps belong in the PR
description, not the long-term developer doc. The doc now covers
steady-state setup only.
* chore: cleanup configs
* refactor(config): reorganize YAML into web/backend containers
Move scattered fields into logical containers:
- web.port (was ports.web)
- backend.port, backend.apiUrl, backend.originsAllowed, backend.compassToken
(were ports.backend, urls.backendApi, urls.cors, tokens.compassSync)
- tokens section now only holds googleCalendarNotification (optional)
Replace getGcalWebhookBaseURL() utility with a schema-level field:
GCAL_WEBHOOK_BASEURL is now always set during config parsing
(googleWebhook ?? backendApiUrl), making the fallback explicit and
removing the need for a lazy accessor function.
Also fixes two pre-existing bugs found during the refactor:
- google-import.service.ts imported from a non-existent api-base-url.util
- gcal.service.test.ts mocked that same phantom module; now mocks CONFIG directly
- google.oauth.client, supertokens.middleware, config.controller imported
isGoogleConfigured from config.constants instead of config.util
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(tests): update env.constants → config.constants across test files
- Replace all imports of ENV from env.constants with CONFIG as ENV
from config.constants (compatible alias, no test logic changed)
- Fix google-watch-token.test.ts: mock config.constants instead of
the now-removed env.constants module
- Export parseConfigFromEnv (was private parseConfig) for test access
- Rewrite config.constants.test.ts to match current behavior:
- GCAL_WEBHOOK_BASEURL now falls back to BASEURL instead of undefined
- Non-HTTPS webhook URLs are accepted (HTTPS check is in superRefine)
- Remove getApiBaseURL tests (function no longer exists)
- Import isGoogleConfigured from config.util
- Fix migration/seeder import paths for env.constants → config.constants
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(test): replace ENV with CONFIG
* refactor(config): dissolve urls section into web and backend containers
Move urls.frontend → web.url, urls.googleWebhook → backend.googleWebhook,
urls.health → backend.healthUrl. The urls group no longer exists; all URL
fields now live under the container they belong to.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(config): remove unused backend.healthUrl field
The field was only read by the self-host shell scripts as an optional
override for the health probe URL; the backend never consumed it at
runtime. The default (http://localhost:<port>/api/health) is sufficient.
Also fix stale urls.frontend / urls.health / ports.backend references
in the self-host/compass helper.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(config): move googleWebhook and notificationToken under google section
tokens.googleCalendarNotification → google.notificationToken
backend.googleWebhook → google.webhookUrl
Both fields are only relevant when Google is configured, so they belong
under the google group. Removes the now-empty tokens section entirely.
Also brings packages/backend/compass.yaml up to date with the current
schema (it still used ports/urls/tokens from before earlier migrations).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: remove github section from config.md
* fix(config): walk up directory tree when searching for compass.yaml
Scripts run from a subdirectory (e.g. bun dev:web cd-s into packages/web)
would fail to find compass.yaml at the repo root because the old lookup
only checked process.cwd() exactly. Walking up mirrors how dotenv and
similar tools discover config files regardless of invocation directory.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(config): fail fast on REPLACE_WITH_* placeholder values at startup
Standardise example YAML placeholders to REPLACE_WITH_* (uppercase +
underscore) and add a recursive scanner in parseCompassConfigText that
fires after Zod validation. Any string value containing REPLACE_WITH_ —
including values embedded inside URIs — is collected and thrown as a
single error listing every affected field path. Since all entry points
(backend, scripts, web dev) call parseCompassConfigText, the guard fires
everywhere. The compass-self-host-placeholder Google values intentionally
do not use this prefix so leaving Google unconfigured stays valid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: add comments for compass token
* docs: update example config and doc
* refactor(config): remove Google OAuth placeholder constants in favor of empty/undefined values
* API Error: 529 {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"},"request_id":"req_011Cb3RMWeJgeK1XQGWyx1LF"}
* fix(self-host): use localhost URLs by default and prevent config loss with existing volumes
* fix(self-host): simplify installer check by removing gcal check
no need to overcomplicate with a standalone function for one key
* fix(backend): initialize mongo after connect resolves
* test: cleanup playwright config
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 77340ab commit 24184b1
81 files changed
Lines changed: 1317 additions & 937 deletions
File tree
- .github/workflows
- docs
- CI-CD
- Config
- acceptance
- development
- features
- self-hosting
- e2e
- packages
- backend
- src
- __tests__
- drivers
- helpers
- auth
- controllers
- middleware
- services/google
- clients
- util
- common
- constants
- errors/handlers
- middleware
- services
- gcal
- util
- config
- controllers
- email
- sync/services
- import
- watch
- core
- src
- config
- constants
- scripts/src
- __tests__/integration
- commands
- delete
- common
- migrations
- seeders
- testing
- web
- src
- common/constants
- components/CompassProvider
- self-host
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
29 | 41 | | |
30 | | - | |
31 | | - | |
| 42 | + | |
32 | 43 | | |
33 | 44 | | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
38 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments