From 1f661fcd3b6acdfb6ab2ffcff14b82ced7ba752e Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 10 Dec 2022 16:26:38 +0100 Subject: [PATCH] wipe: Add wipe_mail.from configuration --- api/api.py | 10 +++++----- services/wipe/config/.env | 1 + services/wipe/vars/main.yml | 23 ++++++++++------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/api/api.py b/api/api.py index 1aad64c..2c80d3e 100644 --- a/api/api.py +++ b/api/api.py @@ -3,7 +3,7 @@ import uuid import ansible_runner import os import sys -from typing import Any, Dict +from typing import Any, Dict, List from fastapi import FastAPI, HTTPException, Request, Security, Depends from fastapi.responses import StreamingResponse from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials @@ -112,7 +112,7 @@ app = FastAPI( ) -@app.get("/deployment") +@app.get("/deployment", response_model=List[DeploymentDTO]) async def deployment_list(request: Request, user: User = Depends(get_user)): return [ DeploymentDTO.from_deployment(deployment, request) @@ -150,7 +150,7 @@ async def deployment_logs( return StreamingResponse(stream(), media_type="text/plain") -@app.get("/deployment/{id}") +@app.get("/deployment/{id}", response_model=DeploymentDTO) async def deployment( request: Request, deployment: Deployment = Depends(get_deployment), @@ -162,10 +162,10 @@ async def deployment( detail=f"This token does not allow to access {deployment.args.service} deployments.", ) - return DeploymentDTO.from_deployment(deployments[id], request) + return DeploymentDTO.from_deployment(deployment, request) -@app.post("/deployment") +@app.post("/deployment", response_model=DeploymentDTO) async def deploy(args: DeployArgs, request: Request, user: User = Depends(get_user)): if args.service not in user.allowed_services: raise HTTPException( diff --git a/services/wipe/config/.env b/services/wipe/config/.env index cf6e82b..3c550a8 100644 --- a/services/wipe/config/.env +++ b/services/wipe/config/.env @@ -12,6 +12,7 @@ QUEUE_DRIVER=sync MAIL_DRIVER=smtp MAIL_HOST={{ wipe_mail.host }} MAIL_PORT={{ wipe_mail.port|default(587) }} +MAIL_FROM="{{ wipe_mail.from }}" MAIL_USERNAME={{ wipe_mail.user }} MAIL_PASSWORD={{ wipe_mail.password }} MAIL_ENCRYPTION={{ wipe_mail.encryption|default("tls") }} diff --git a/services/wipe/vars/main.yml b/services/wipe/vars/main.yml index 96c9e4a..d9f18ef 100644 --- a/services/wipe/vars/main.yml +++ b/services/wipe/vars/main.yml @@ -14,18 +14,15 @@ wipe_steam_key: !vault | 37303233613065646638303535643535386162316330316161383537313132626261356465313065 6134633232366434643833333762316462363639653034636438 wipe_mail: - host: smtp.googlemail.com - user: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 31346166396462643734663735323164343665393930613665643963616538363363346561343531 - 6538613135353762656434383831386438636565373865650a623730643062643538663235616363 - 34363938383133633964666130396265343134623939323562363234313664386337636635633035 - 3939643362333366300a376135393436663765316132643639366466373665663133363761366234 - 38306230633661653133653961356633376166633761333738633030643765313135 + host: smtp.zoho.com + user: wipe@kadet.net + from: "WIPE #7 " + encryption: 'ssl' + port: 465 password: !vault | $ANSIBLE_VAULT;1.1;AES256 - 31663537613531663362383135343538393663383566383030643339643733326333663133663362 - 3566303538353239666139363764373166626261366435330a646166623736636566346162366164 - 33636566393161336362643038353163623264393134353639653339613066343965303434303234 - 6666613363613731330a643065613838356131633031356233656535363138323366373737393135 - 38633831306539613634326530383234306361623237633832623662333539626339 + 31316133303937316531303931313766366230323862343038616465663865323233616466313865 + 6366376233333032313832646461353865663463623732370a393435663334306161636362663238 + 34353431356132353464643662643531333961323938316638643734323035336164356630306635 + 3730396332633166380a626538623530353261333964663665393231356238316132643133383233 + 39656463623665646465383361666537333639613263393634313432323561393166