Skip to content

Commit

Permalink
AWS_REGION fix (intelowlproject#2541)
Browse files Browse the repository at this point in the history
* AWS_REGION

* AWS_REGION

* AWS_REGION

* AWS_REGION
  • Loading branch information
mlodic authored Oct 22, 2024
1 parent 9cec152 commit 68765cb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion intel_owl/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_secret(secret_name, default=""):
"""
secret = os.environ.get(secret_name, default)
aws_secrets_enabled = os.environ.get("AWS_SECRETS", False) == "True"
if not secret and aws_secrets_enabled:
if not secret and aws_secrets_enabled and not secret_name == "AWS_REGION":
try:
secret = aws_get_secret(secret_name)
except RetrieveSecretException as e:
Expand Down
1 change: 1 addition & 0 deletions intel_owl/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"treebeard",
]

from .a_secrets import * # lgtm [py/polluting-import]
from .auth import * # lgtm [py/polluting-import]
from .aws import * # lgtm [py/polluting-import]
from .cache import * # lgtm [py/polluting-import]
Expand Down
7 changes: 7 additions & 0 deletions intel_owl/settings/a_secrets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl
# See the file 'LICENSE' for copying permission.

from intel_owl import secrets

# this must be first because the function get_secretes depends from it
AWS_REGION = secrets.get_secret("AWS_REGION", "eu-central-1")
1 change: 0 additions & 1 deletion intel_owl/settings/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
AWS_SECRET_ACCESS_KEY = secrets.get_secret("AWS_SECRET_ACCESS_KEY")
AWS_SECRETS = secrets.get_secret("AWS_SECRETS", False) == "True"
AWS_SQS = secrets.get_secret("AWS_SQS", False) == "True"
AWS_REGION = secrets.get_secret("AWS_REGION", "eu-central-1")
AWS_USER_NUMBER = secrets.get_secret("AWS_USER_NUMBER")

AWS_RDS_IAM_ROLE = secrets.get_secret("AWS_RDS_IAM_ROLE", False) == "True"
3 changes: 2 additions & 1 deletion intel_owl/settings/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

from intel_owl import secrets

from .aws import AWS_RDS_IAM_ROLE, AWS_REGION
from .a_secrets import AWS_REGION
from .aws import AWS_RDS_IAM_ROLE

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

Expand Down
2 changes: 1 addition & 1 deletion intel_owl/settings/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See the file 'LICENSE' for copying permission.

from ._util import get_secret
from .aws import AWS_REGION
from .a_secrets import AWS_REGION
from .commons import STAGE_CI, STAGE_LOCAL

DEFAULT_FROM_EMAIL = get_secret("DEFAULT_FROM_EMAIL")
Expand Down

0 comments on commit 68765cb

Please sign in to comment.