Skip to content

Commit

Permalink
🔧 Modify settings.py to get secret variables in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yjeong-k committed Oct 25, 2023
1 parent 8532858 commit ca00265
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
secret_file = os.path.join(BASE_DIR, 'secrets.json') # secrets.json 파일 위치를 명시

with open(secret_file) as f:
secrets = json.loads(f.read())
if "GITHUB_ACTIONS" in os.environ:
# If running in GitHub Actions, use secrets from environment variables
secrets = {
"SECRET_KEY": os.environ.get("SECRET_KEY"),
"EMAIL_HOST_USER": os.environ.get("EMAIL_HOST_USER"),
"EMAIL_HOST_PASSWORD": os.environ.get("EMAIL_HOST_PASSWORD"),
}
else:
secret_file = os.path.join(BASE_DIR, 'secrets.json') # secrets.json 파일 위치를 명시
with open(secret_file) as f:
secrets = json.loads(f.read())


def get_secret(setting, secrets=secrets):
Expand Down

0 comments on commit ca00265

Please sign in to comment.