Skip to content

Commit 6601bc4

Browse files
committed
refactor: remove SILL_ in env variable and simplify setup in env.ts
1 parent 9d67f9b commit 6601bc4

File tree

5 files changed

+28
-43
lines changed

5 files changed

+28
-43
lines changed

api/src/env.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ const zEnvConfiguration = z.object({
2424

2525
const envConfiguration = zEnvConfiguration.parse({
2626
"oidcParams": {
27-
"issuerUri":
28-
process.env.OIDC_ISSUER_URI ?? `${process.env.SILL_KEYCLOAK_URL}/realms/${process.env.SILL_KEYCLOAK_REALM}`,
29-
"clientId": process.env.OIDC_CLIENT_ID ?? process.env.SILL_KEYCLOAK_CLIENT_ID
27+
"issuerUri": process.env.OIDC_ISSUER_URI,
28+
"clientId": process.env.OIDC_CLIENT_ID
3029
},
31-
"termsOfServiceUrl": process.env.SILL_TERMS_OF_SERVICE_URL,
32-
"githubPersonalAccessTokenForApiRateLimit": process.env.SILL_GITHUB_TOKEN,
33-
"port": parseInt(process.env.SILL_API_PORT ?? ""),
34-
"isDevEnvironnement": process.env.SILL_IS_DEV_ENVIRONNEMENT?.toLowerCase() === "true",
35-
"externalSoftwareDataOrigin": process.env.SILL_EXTERNAL_SOFTWARE_DATA_ORIGIN,
36-
"redirectUrl": process.env.SILL_REDIRECT_URL,
30+
"termsOfServiceUrl": process.env.TERMS_OF_SERVICE_URL,
31+
"githubPersonalAccessTokenForApiRateLimit": process.env.GITHUB_TOKEN,
32+
"port": parseInt(process.env.API_PORT ?? ""),
33+
"isDevEnvironnement": process.env.IS_DEV_ENVIRONNEMENT?.toLowerCase() === "true",
34+
"externalSoftwareDataOrigin": process.env.EXTERNAL_SOFTWARE_DATA_ORIGIN,
35+
"redirectUrl": process.env.REDIRECT_URL,
3736
"databaseUrl": process.env.DATABASE_URL,
3837
"initializeSoftwareFromSource": process.env.INIT_SOFT_FROM_SOURCE?.toLowerCase() === "true",
3938
"botAgentEmail": process.env?.BOT_AGENT_EMAIL,
40-
"listToImport": process.env?.SILL_IMPORT_WIKIDATA?.split(",")
39+
"listToImport": process.env?.IMPORT_WIKIDATA?.split(",")
4140
});
4241

4342
export const env = {
Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
SILL_KEYCLOAK_URL=http://localhost:8081/auth
2-
SILL_KEYCLOAK_REALM=codegouv
3-
SILL_KEYCLOAK_CLIENT_ID=sill
4-
SILL_README_URL=https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/README.md
5-
SILL_TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
6-
SILL_JWT_ID=sub
7-
SILL_JWT_EMAIL=email
8-
SILL_JWT_ORGANIZATION=organization
9-
SILL_GITHUB_TOKEN=xxxxx
10-
SILL_API_PORT=3084
11-
SILL_IS_DEV_ENVIRONNEMENT=true
12-
SILL_EXTERNAL_SOFTWARE_DATA_ORIGIN=wikidata
13-
SILL_IMPORT_WIKIDATA=Q10135,Q25874683
1+
OIDC_ISSUER_URI=https://auth.code.gouv.fr/auth/realms/codegouv
2+
OIDC_CLIENT_ID=sill
3+
4+
TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
5+
6+
API_PORT=3084
7+
IS_DEV_ENVIRONNEMENT=true
8+
EXTERNAL_SOFTWARE_DATA_ORIGIN=wikidata
9+
IMPORT_WIKIDATA=Q10135,Q25874683
1410
INIT_SOFT_FROM_SOURCE=false
1511
BOT_AGENT_EMAIL=[email protected]
1612

1713
DATABASE_URL=postgresql://sill:pg_password@localhost:5432/sill
1814

19-
# Theses variables are used by docker-compose files to create the Postgres docker
20-
POSTGRES_DB=sill
21-
POSTGRES_USER=sill
22-
POSTGRES_PASSWORD=pg_password
23-
24-
# this is only for the script load-git-repo-in-pg.ts, not needed for api any more
25-
SILL_DATA_REPO_SSH_URL=[email protected]:codegouvfr/sill-data-test.git
26-
SILL_SSH_NAME=id_ed25519
27-
SILL_SSH_PRIVATE_KEY="-----BEGIN OPENSSH PRIVATE KEY-----\n....PASTE_YOUR_KEY...\n-----END OPENSSH PRIVATE KEY-----\n"
15+
# REDIRECT_URL=https://your-redirect-url

docs/deploying-the-web-app-bare-metal.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ Create a `.env` file with a content like this
5353
```
5454
OIDC_ISSUER_URI=http://localhost:8081/auth/realms/codegouv
5555
OIDC_CLIENT_ID=sill
56-
SILL_README_URL=https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/docs/sill.md
57-
SILL_TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
58-
SILL_GITHUB_TOKEN=ghp_xxxxxx
59-
SILL_API_PORT=3084
60-
SILL_IS_DEV_ENVIRONNEMENT=true
56+
TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
57+
GITHUB_TOKEN=ghp_xxxxxx
58+
API_PORT=3084
59+
IS_DEV_ENVIRONNEMENT=true
6160
DATABASE_URL=postgresql://sill:pg_password@localhost:5432/sill
6261
```
6362

docs/deploying-with-docker-compose.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cp .env.sample .env
1010

1111
You will need to provide an ssh key in SILL_SSH_PRIVATE_KEY, and it should have the access to the repo you provide in SILL_DATA_REPO_SSH_URL
1212

13-
You will also need to provide a SILL_GITHUB_TOKEN.
13+
You will also need to provide a GITHUB_TOKEN.
1414

1515
You can change the way you handle the frontal part in the [nging configuration file](https://github.com/codegouvfr/sill/blob/main/deployments/docker-compose-example/nginx/default.conf).
1616
The provided example is basic, and for example it does not provide support for `https` (you would need to configure it with you SSL certificates).

docs/setting-up-a-development-environment.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ Makes sure to put the name of your SSH key and the private key (generated when y
2626
```
2727
OIDC_ISSUER_URI=http://localhost:8081/auth/realms/codegouv
2828
OIDC_CLIENT_ID=sill
29-
SILL_README_URL=https://raw.githubusercontent.com/codegouvfr/sill/refs/heads/main/docs/sill.md
30-
SILL_TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
31-
SILL_GITHUB_TOKEN=ghp_xxxxxx
32-
SILL_API_PORT=3084
33-
SILL_IS_DEV_ENVIRONNEMENT=true
29+
TERMS_OF_SERVICE_URL=https://code.gouv.fr/sill/tos_fr.md
30+
GITHUB_TOKEN=ghp_xxxxxx
31+
API_PORT=3084
32+
IS_DEV_ENVIRONNEMENT=true
3433
DATABASE_URL=postgresql://sill:pg_password@localhost:5432/sill
3534
```
3635

0 commit comments

Comments
 (0)