Skip to content

Commit

Permalink
Merge pull request #58 from FREVA-CLINT/sendgrid
Browse files Browse the repository at this point in the history
Integrade sendgrid API.
  • Loading branch information
antarcticrainforest authored Aug 19, 2024
2 parents 2016b32 + bfd1e29 commit 4ba8a46
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:
with:
context: .
platforms: linux/amd64
build-args: VERSION=${{steps.repository.outputs.tag}}
build-args: |
VERSION=${{steps.repository.outputs.tag}}
EMAIL_HOST_PASSWORD=${{secrets.EMAIL_HOST_PASSWORD}}
push: true
tags: |
ghcr.io/${{ steps.repository.outputs.repo }}:${{ steps.repository.outputs.tag }}
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG CONDA_ENV_DIR=/opt/condaenv
ARG FREVA_WEB_DIR=/opt/freva_web
ARG EMAIL_HOST_PASSWORD=""
ARG VERSION

FROM condaforge/mambaforge
Expand All @@ -14,7 +15,8 @@ RUN set -e && \
WORKDIR ${FREVA_WEB_DIR}
COPY . .
ENV PATH=$CONDA_ENV_DIR/bin:$PATH\
DJANGO_SUPERUSER_EMAIL=freva@dkrz.de
DJANGO_SUPERUSER_EMAIL=freva@dkrz.de\
EMAIL_HOST_PASSWORD=$EMAIL_HOST_PASSWORD
RUN set -e && \
mamba env create -y -p ${CONDA_ENV_DIR} -f conda-env.yml &&\
mamba clean -afy &&\
Expand Down
27 changes: 5 additions & 22 deletions django_evaluation/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ def _get_logo(logo_file, project_root):
return f"/static/img/{logo_file.name}"


def _read_secret(port: int = 5002, key: str = "email") -> dict[str, str]:
"""Read the key-value pair secrets from vault server."""
sha = config._get_public_key(config.get("project_name"))
uri = f"http://{config.get('db.host')}:{port}/vault/{key}/{sha}"
try:
req = requests.get(uri).json()
except requests.exceptions.ConnectionError:
req = {}
return req


def _set_favicon(html_color: str, project_root: Path) -> None:
img_folder = Path(project_root) / "static" / "img"
tmpl_folder = Path(project_root) / "static_root" / "img"
Expand Down Expand Up @@ -241,17 +230,11 @@ def _set_favicon(html_color: str, project_root: Path) -> None:
SERVER_EMAIL = os.environ.get("SERVER_EMAIL", "freva@dkrz.de")
DEFAULT_FROM_EMAIL = SERVER_EMAIL

EMAIL_HOST = os.environ.get("EMAIL_HOST", "mailhost.dkrz.de")

EMAIL_PORT = int(os.environ.get("EMAIL_PORT", "25"))
if EMAIL_PORT == 25:
EMAIL_HOST_USER = ""
EMAIL_HOST_PASSWORD = ""
else:
email_secrets = _read_secret()
EMAIL_HOST_USER = email_secrets.get("username")
EMAIL_HOST_PASSWORD = email_secrets.get("password")

EMAIL_HOST = "smtp.sendgrid.net"
EMAIL_PORT = "587"
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "apikey"
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD")

HOME_DIRS_AVAILABLE = False

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evaluation_system_web",
"version": "2405.0.0",
"version": "2408.0.0",
"description": "React-bits of the freva-web interface. The react-parts of the web interface include the plugin-selection, the data-browser and the result-browser",
"main": "index.js",
"engines": {
Expand Down

0 comments on commit 4ba8a46

Please sign in to comment.