-
Notifications
You must be signed in to change notification settings - Fork 47
Standardise environment variable handling #1235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
07f6900
8d98cc5
874630d
835c2d3
64dfe87
3be4ac0
5da4214
0eca05e
e6098ce
9df5955
0a308c9
b233b85
61e1f38
203fc8f
2989539
f5ed1d8
62c4309
3fd7a66
60fe419
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,17 +76,23 @@ CLICKHOUSE_PROTOCOL=http | |
| HMA_SERVICE_URL=http://localhost:9876 | ||
|
|
||
| # Scylla Cluster Details | ||
| # Set to "false" to run Coop without a Scylla cluster. This disables the two | ||
| # Scylla-backed features — Item Investigation (item/user history views) and | ||
| # User Strikes (repeat-offender strike counts) — which then no-op: reads return | ||
| # empty (strike counts read as 0) and writes are dropped. When "false" (or | ||
| # "0"/"no"), the SCYLLA_* connection settings below are not required. | ||
| # Defaults to enabled. | ||
| ITEM_INVESTIGATION_AND_STRIKES_ENABLED=true | ||
| # Set to "false" (or "0") to run Coop without a Scylla cluster. This disables | ||
| # the two Scylla-backed features — Item Investigation (item/user history views) | ||
| # and User Strikes (repeat-offender strike counts) — which then no-op: reads | ||
| # return empty (strike counts read as 0) and writes are dropped. The SCYLLA_* | ||
| # connection settings below are then not required; otherwise they are, and the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: When Prompt for AI agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Correct the required-setting description. When Scylla is enabled, only 🤖 Prompt for AI Agents |
||
| # process refuses to start without them. Defaults to enabled. | ||
| SCYLLA_ENABLED=true | ||
| SCYLLA_USERNAME=cassandra | ||
| SCYLLA_PASSWORD=cassandra | ||
| SCYLLA_HOSTS='127.0.0.1:9042' | ||
| SCYLLA_LOCAL_DATACENTER='datacenter1' | ||
| SCYLLA_PORT=9042 | ||
| # TLS. SCYLLA_SSL_SERVERNAME sets the SNI value for certificate verification, | ||
| # for when the contact points don't match the server certificate (e.g. an AWS | ||
| # Keyspaces regional endpoint); it defaults to the first contact point. | ||
| SCYLLA_SSL=false | ||
| SCYLLA_SSL_SERVERNAME= | ||
|
|
||
| # Local dev | ||
| NODE_ENV=development | ||
|
|
@@ -99,6 +105,8 @@ REDIS_HOST=localhost | |
| REDIS_PORT=6379 | ||
| REDIS_USER= | ||
| REDIS_PASSWORD= | ||
| # Single-node connections only; cluster connections are always TLS. | ||
| REDIS_TLS=false | ||
|
|
||
| # Signal API Keys/URLs | ||
| OPEN_AI_API_KEY= | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||
| import env from '#start/env'; | ||||||
|
|
||||||
| /** | ||||||
| * Derived on access rather than at import. | ||||||
| * | ||||||
| * `env.get` reads the validated values `Env.create` produced, and `env.set` | ||||||
| * updates them — so a getter lets a test say `env.set('NODE_ENV', 'production')` | ||||||
| * and have the rest of the application agree. A constant would instead hold | ||||||
| * whatever the environment was when this module was first imported. | ||||||
| * | ||||||
| * `NODE_ENV === 'prod'` is silently non-production everywhere it appears; | ||||||
| * `inProduction` is not, which is why the comparison lives here and not at each | ||||||
| * call site. | ||||||
| */ | ||||||
| export default { | ||||||
| get env() { | ||||||
| return env.get('NODE_ENV', 'development'); | ||||||
| }, | ||||||
| get inProduction() { | ||||||
| return this.env === 'production'; | ||||||
| }, | ||||||
| get inDev() { | ||||||
| return this.env === 'development'; | ||||||
| }, | ||||||
| get inTest() { | ||||||
| return this.env === 'test'; | ||||||
| }, | ||||||
|
|
||||||
| // Public origin of the frontend. Used to build the links and redirects the | ||||||
| // application hands out, so it must be the origin a browser reaches, not an | ||||||
| // internal one. | ||||||
| get uiUrl() { | ||||||
| return env.get('UI_URL'); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When Prompt for AI agents
Suggested change
|
||||||
| }, | ||||||
|
|
||||||
| /** Identifies this process in traces and as the Postgres `application_name`. */ | ||||||
| get serviceName() { | ||||||
| return env.get('OTEL_SERVICE_NAME', 'coop-service'); | ||||||
| }, | ||||||
| }; | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This entry does not tell deployers that
ITEM_INVESTIGATION_AND_STRIKES_ENABLEDmust be renamed, so the breaking environment-variable migration is easy to miss. State explicitly that the enablement variable was renamed toSCYLLA_ENABLEDand link the rename to this PR.Prompt for AI agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ITEM_INVESTIGATION_AND_STRIKES_ENABLEDis unreleased, so it's not a breaking change.