Skip to content

Commit

Permalink
build(deps): npm update --save && npm install
Browse files Browse the repository at this point in the history
  • Loading branch information
alee committed Feb 22, 2024
1 parent 17e84ea commit 6134a51
Show file tree
Hide file tree
Showing 5 changed files with 323 additions and 275 deletions.
18 changes: 9 additions & 9 deletions django/core/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

from django.contrib.messages import constants as messages

def read_secret(file, fallback=''):
secrets_file_path = Path('/run/secrets', file)

def read_secret(file, fallback=""):
secrets_file_path = Path("/run/secrets", file)
if secrets_file_path.is_file():
return secrets_file_path.read_text().strip()
else:
return fallback



class Environment(Enum):
DEVELOPMENT = "http://localhost:8000"
STAGING = "https://staging.comses.net"
Expand Down Expand Up @@ -260,7 +260,7 @@ def is_test(self):
# sentry DSN
SENTRY_DSN = os.getenv("SENTRY_DSN", "https://sentry.example.com/2")

SECRET_KEY = read_secret('django_secret_key', os.getenv("SECRET_KEY"))
SECRET_KEY = read_secret("django_secret_key", os.getenv("SECRET_KEY"))

# regular settings

Expand All @@ -278,7 +278,7 @@ def is_test(self):
"ENGINE": "django.db.backends.postgresql",
"NAME": os.getenv("DB_NAME"),
"USER": os.getenv("DB_USER"),
"PASSWORD": read_secret('db_password', os.getenv("DB_PASSWORD")),
"PASSWORD": read_secret("db_password", os.getenv("DB_PASSWORD")),
"HOST": os.getenv("DB_HOST"),
"PORT": os.getenv("DB_PORT"),
}
Expand Down Expand Up @@ -484,10 +484,10 @@ def is_test(self):

ORCID_CLIENT_ID = os.getenv("ORCID_CLIENT_ID", "")

ORCID_CLIENT_SECRET = read_secret('orcid_client_secret')
ORCID_CLIENT_SECRET = read_secret("orcid_client_secret")

GITHUB_CLIENT_ID = os.getenv("GITHUB_CLIENT_ID", "")
GITHUB_CLIENT_SECRET = read_secret('github_client_secret')
GITHUB_CLIENT_SECRET = read_secret("github_client_secret")

TEST_BASIC_AUTH_PASSWORD = os.getenv("TEST_BASIC_AUTH_PASSWORD", "test password")
TEST_USER_ID = os.getenv("TEST_USER_ID", 1000000)
Expand All @@ -513,8 +513,8 @@ def is_test(self):
DISCOURSE_BASE_URL = os.getenv(
"DISCOURSE_BASE_URL", "https://staging-discourse.comses.net"
)
DISCOURSE_SSO_SECRET = read_secret('discourse_sso_secret', "unconfigured")
DISCOURSE_API_KEY = read_secret('discourse_api_key', "unconfigured")
DISCOURSE_SSO_SECRET = read_secret("discourse_sso_secret", "unconfigured")
DISCOURSE_API_KEY = read_secret("discourse_api_key", "unconfigured")
DISCOURSE_API_USERNAME = os.getenv("DISCOURSE_API_USERNAME", "unconfigured")

# https://docs.djangoproject.com/en/4.2/ref/settings/#templates
Expand Down
4 changes: 2 additions & 2 deletions django/core/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# EMAIL_FILE_PATH = '/shared/logs/mail.log'
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"

MAILGUN_API_KEY = read_secret('mail_api_key')
MAILGUN_API_KEY = read_secret("mail_api_key")
MAILGUN_SENDER_DOMAIN = os.getenv("MAILGUN_SENDER_DOMAIN", "mg.comses.net")
EMAIL_SUBJECT_PREFIX = os.getenv("EMAIL_SUBJECT_PREFIX", "[staging.comses.net]")
EMAIL_USE_TLS = True
Expand Down Expand Up @@ -104,7 +104,7 @@

# hcaptcha config
HCAPTCHA_SITEKEY = os.getenv("HCAPTCHA_SITEKEY", "")
HCAPTCHA_SECRET = read_secret('hcaptcha_secret', 'unconfigured')
HCAPTCHA_SECRET = read_secret("hcaptcha_secret", "unconfigured")

WSGI_APPLICATION = "core.wsgi.application"

Expand Down
5 changes: 1 addition & 4 deletions django/library/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,6 @@ def __init__(self, metadata: dict):

@classmethod
def convert_target_product(cls, codebase_release: CodebaseRelease):

target_product = {
"@type": "SoftwareApplication",
"name": codebase_release.title,
Expand All @@ -2382,9 +2381,7 @@ def convert_target_product(cls, codebase_release: CodebaseRelease):
)
image_urls = codebase_release.codebase.get_image_urls()
if image_urls:
target_product.update(
screenshot=f"{settings.BASE_URL}{image_urls[0]}"
)
target_product.update(screenshot=f"{settings.BASE_URL}{image_urls[0]}")
return target_product

@classmethod
Expand Down
Loading

0 comments on commit 6134a51

Please sign in to comment.