Skip to content

Commit 2d1c68d

Browse files
committed
feat: update doppler sync
1 parent d43f9fb commit 2d1c68d

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PORT="3001"
44
HOST="localhost" # Hostname for the server
55

66
# CORS Settings
7-
CORS_ORIGIN="http://localhost:*" # Allowed CORS origin, adjust as necessary
7+
CORS_ORIGIN="*" # Allowed CORS origin, adjust as necessary
88

99
# Rate Limiting
1010
COMMON_RATE_LIMIT_WINDOW_MS="1000" # Window size for rate limiting (ms)

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Instalation
2-
Copy `.env.template` to `.env` and set configuration
32

3+
Install npm packages
44
```
55
npm i
66
```
77

8+
Copy `.env.template` to `.env` and set configuration. Alternatively use:
9+
```
10+
npm run doppler:syncdev # local development
11+
npm run doppler:syncstg # staging
12+
npm run doppler:syncprd # production
13+
```
14+
815
# Running
916

1017
Dev server

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
"lint:fix": "biome check src/ --fix",
1717
"format": "biome format src/",
1818
"test": "vitest run",
19-
"prepare": "husky"
19+
"prepare": "husky",
20+
"doppler:login": "./scripts/dopplerLogin.sh",
21+
"doppler:syncdev": "TOKEN=dev ./scripts/dopplerSync.sh",
22+
"doppler:syncstg": "TOKEN=stg ./scripts/dopplerSync.sh",
23+
"doppler:syncprd": "TOKEN=prd ./scripts/dopplerSync.sh"
2024
},
2125
"dependencies": {
2226
"@asteasolutions/zod-to-openapi": "7.2.0",

scripts/dopplerSync.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/bin/bash
2-
TOKENS=("local")
2+
: "${TOKEN:=dev}" # default dev
33
PROJECT_NAME="euler-swap-api"
44

5-
6-
for TOKEN in ${TOKENS[@]}; do
7-
# Download secrets and store them in a temporary file
8-
doppler setup -p $PROJECT_NAME --config $TOKEN && doppler secrets download --no-file --format env > .env.${TOKEN}
9-
done
10-
11-
# .env.${ENV/-/.} => ${string/substring/replacement} | replaces the - with a dot.
12-
# In doppler UI those can't use dots in the env naming but locally we want them
5+
# Download secrets and store them in a temporary file
6+
doppler setup -p $PROJECT_NAME --config $TOKEN && doppler secrets download --no-file --format env > .env

0 commit comments

Comments
 (0)