Skip to content

Commit ef65757

Browse files
committed
fix: environment variables
1 parent 684f9f8 commit ef65757

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

.env/.env.development

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
# 3. Shared environment (.env).
88
#
99
# 🚫 DO NOT PUT SECRETS HERE 🚫
10+
11+
# GitHub
12+
GH_CLIENT_ID="Ov23liFxLb96ubvBRG2O"

.env/.env.local

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
# 2. Shared environment (.env).
77
#
88
# 🚫 DO NOT PUT SECRETS HERE 🚫
9+
10+
# GitHub
11+
GH_CLIENT_ID="Ov23liBErSabQFqROeMg"

.env/.env.production

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
# 3. Shared environment (.env).
88
#
99
# 🚫 DO NOT PUT SECRETS HERE 🚫
10+
11+
# GitHub
12+
GH_CLIENT_ID="Ov23liP5TXOmoYIDBmLB"

.env/.env.staging

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
# 3. Shared environment (.env).
88
#
99
# 🚫 DO NOT PUT SECRETS HERE 🚫
10+
11+
# GitHub
12+
GH_CLIENT_ID="Ov23liHsmlS8msOMUqLd"

settings.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,20 @@ def set_up_settings(service_base_dir: Path, service_name: str):
2222
2323
*This needs to be called before importing the CFL settings!*
2424
25+
To expose a secret to your Django project, you'll need to create a setting
26+
for it following Django's conventions.
27+
2528
Examples:
2629
```
2730
from codeforlife import set_up_settings
2831
2932
# Must set up settings before importing them!
30-
SECRETS = set_up_settings("example")
33+
secrets = set_up_settings("example")
3134
3235
from codeforlife.settings import *
36+
37+
# Expose secret to django project.
38+
MY_SECRET = secrets["MY_SECRET"]
3339
```
3440
3541
Args:
@@ -119,8 +125,8 @@ def set_up_settings(service_base_dir: Path, service_name: str):
119125
GH_ORG = "ocadotechnology"
120126
GH_REPO = "codeforlife-workspace"
121127
GH_FILE = "CONTRIBUTING.md"
122-
GH_CLIENT_ID = os.getenv("GH_CLIENT_ID", "Ov23liBErSabQFqROeMg")
123-
GH_CLIENT_SECRET = os.getenv("GH_CLIENT_SECRET", "replace-me")
128+
GH_CLIENT_ID = os.environ["GH_CLIENT_ID"]
129+
GH_CLIENT_SECRET = SECRETS["GH_CLIENT_SECRET"]
124130

125131
# Installed Apps
126132
# https://docs.djangoproject.com/en/3.2/ref/settings/#installed-apps

0 commit comments

Comments
 (0)