Skip to content

Commit

Permalink
Add secret key to worker, API (#333)
Browse files Browse the repository at this point in the history
- **Add env var secret to worker, API**
- **Read key in worker**
  • Loading branch information
shaldengeki authored Aug 2, 2024
1 parent 310ab98 commit a3baf79
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ark_nova_stats/worker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def archive_logs_to_tigris(
return new_archive


API_SECRET_KEY = os.getenv("API_WORKER_SECRET")


def main() -> int:
tigris_client = boto3.client("s3", endpoint_url=os.getenv("AWS_ENDPOINT_URL_S3"))
with app.app_context():
Expand Down
1 change: 1 addition & 0 deletions base/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def FlaskApp(name) -> tuple[Flask, CORS, SQLAlchemy, Migrate]:
app.config.update(
FRONTEND_URL=frontend_url,
SECRET_KEY=os.getenv("FLASK_SECRET_KEY", "testing"),
WORKER_SECRET=os.getenv("API_WORKER_SECRET", "test-api-worker-secret"),
SQLALCHEMY_DATABASE_URI=database_uri(),
SQLALCHEMY_ENGINE_OPTIONS={
"connect_args": {
Expand Down
3 changes: 3 additions & 0 deletions skeleton/worker/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import time

from skeleton.config import app, db

max_delay = 10

API_SECRET_KEY = os.getenv("API_WORKER_SECRET")


def main() -> int:
with app.app_context():
Expand Down
1 change: 1 addition & 0 deletions tools/build_rules/api/api_image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def api_image(
"DB_PASSWORD": "development",
"DATABASE_NAME": "api_development",
"FLASK_SECRET_KEY": "testing",
"API_WORKER_SECRET": "test-api-worker-secret",
}
container_env.update(env)

Expand Down
1 change: 1 addition & 0 deletions tools/build_rules/worker/worker.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def worker(
"DB_PASSWORD": "development",
"DATABASE_NAME": "api_development",
"FLASK_SECRET_KEY": "testing",
"API_WORKER_SECRET": "test-api-worker-secret",
}
all_env.update(env)

Expand Down

0 comments on commit a3baf79

Please sign in to comment.