Skip to content

Commit

Permalink
Fix Prod Env Vars (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
avgupta456 authored Nov 25, 2023
1 parent c0e9a05 commit 8fbfe4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
9 changes: 6 additions & 3 deletions backend/deploy/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ steps:
args: ["run", "create-env"]
dir: "backend"
env:
- "OAUTH_CLIENT_ID=${_OAUTH_CLIENT_ID}"
- "OAUTH_CLIENT_SECRET=${_OAUTH_CLIENT_SECRET}"
- "OAUTH_REDIRECT_URI=${_OAUTH_REDIRECT_URI}"
- "DEV_OAUTH_CLIENT_ID=${_DEV_OAUTH_CLIENT_ID}"
- "DEV_OAUTH_CLIENT_SECRET=${_DEV_OAUTH_CLIENT_SECRET}"
- "DEV_OAUTH_REDIRECT_URI=${_DEV_OAUTH_REDIRECT_URI}"
- "PROD_OAUTH_CLIENT_ID=${_PROD_OAUTH_CLIENT_ID}"
- "PROD_OAUTH_CLIENT_SECRET=${_PROD_OAUTH_CLIENT_SECRET}"
- "PROD_OAUTH_REDIRECT_URI=${_PROD_OAUTH_REDIRECT_URI}"
- "MONGODB_PASSWORD=${_MONGODB_PASSWORD}"
- "SENTRY_DSN=${_SENTRY_DSN}"
- name: "gcr.io/cloud-builders/gcloud"
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"gen-lang-map": "poetry run python src/data/github/language_map.py",
"start": "poetry run uvicorn src.main:app --reload --port=8000",
"set-reqs": "poetry lock && poetry export -f requirements.txt --output requirements.txt --without-hashes",
"create-env": "printenv && printenv > .env",
"create-env": "printenv > .env",
"test": "poetry run coverage run --source=src -m unittest -v && poetry run coverage report",
"isort": "poetry run isort . --src-path=./src --multi-line=3 --trailing-comma --line-length=88 --combine-as --ensure-newline-before-comments"
}
Expand Down
5 changes: 0 additions & 5 deletions backend/src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
# redirect uri for App
OAUTH_REDIRECT_URI = os.getenv(f"{prefix}_OAUTH_REDIRECT_URI", "")

print("prefix", prefix)
print("OAUTH_CLIENT_ID", OAUTH_CLIENT_ID)
print("OAUTH_CLIENT_SECRET", OAUTH_CLIENT_SECRET)
print("OAUTH_REDIRECT_URI", OAUTH_REDIRECT_URI)

# MONGODB
MONGODB_PASSWORD = os.getenv("MONGODB_PASSWORD", "")

Expand Down
6 changes: 1 addition & 5 deletions backend/src/data/github/auth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,10 @@ async def authenticate(code: str) -> Tuple[str, str]:
"redirect_uri": OAUTH_REDIRECT_URI,
}

print(params)

r = s.post("https://github.com/login/oauth/access_token", params=params)

print(r.status_code, r.text)

if r.status_code != 200:
raise OAuthError(f"OAuth Error: {str(r.status_code)} {r.text}")
raise OAuthError(f"OAuth Error: {str(r.status_code)}")

access_token = r.text.split("&")[0].split("=")[1]
user_id = get_unknown_user(access_token)
Expand Down

0 comments on commit 8fbfe4f

Please sign in to comment.