feat: Add Nomad deployment configuration and update email handling
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 19s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 19s
This commit is contained in:
3
.env.example
Normal file
3
.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
GMAIL_USER=your_email@gmail.com
|
||||
GMAIL_APP_PASSWORD=your_app_password
|
||||
RECIPIENT_EMAIL=recipient1@example.com,recipient2@example.com
|
||||
2
.github/workflows/nomad-deploy.yml
vendored
2
.github/workflows/nomad-deploy.yml
vendored
@@ -53,4 +53,4 @@ jobs:
|
||||
nomad status
|
||||
nomad job run \
|
||||
-var="container_version=${{ steps.container_version.outputs.sha }}" \
|
||||
foodplanner.nomad
|
||||
finance-app.nomad
|
||||
|
||||
35
.gitignore
vendored
Normal file
35
.gitignore
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Secrets
|
||||
.env
|
||||
.env.local
|
||||
.env.*
|
||||
*.pem
|
||||
*.key
|
||||
id_rsa
|
||||
secrets/
|
||||
|
||||
# IDEs
|
||||
.idea/
|
||||
.vscode/
|
||||
26
finance-app.nomad
Normal file
26
finance-app.nomad
Normal file
@@ -0,0 +1,26 @@
|
||||
job "finance-app" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
variable "container_version" {
|
||||
default = "latest"
|
||||
}
|
||||
|
||||
group "finance-app" {
|
||||
count = 1
|
||||
|
||||
task "finance-app" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "gitea.service.dc1.fbleagh.duckdns.org/sstent/DailyEmail-Finance:${var.container_version}"
|
||||
}
|
||||
|
||||
env {
|
||||
GMAIL_USER = "stuart.stent@gmail.com"
|
||||
GMAIL_APP_PASSWORD = "qacyyoxcddwbxyfw"
|
||||
RECIPIENT_EMAIL = "stuart.stent@gmail.com,sdoltonz@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
main.py
5
main.py
@@ -42,6 +42,11 @@ class FinanceEmailer:
|
||||
self.gmail_app_password = os.environ.get('GMAIL_APP_PASSWORD')
|
||||
self.recipient_email = os.environ.get('RECIPIENT_EMAIL')
|
||||
|
||||
if self.recipient_email:
|
||||
# Clean up and normalize email list
|
||||
recipients = [e.strip() for e in self.recipient_email.split(',') if e.strip()]
|
||||
self.recipient_email = ", ".join(recipients)
|
||||
|
||||
if not all([self.gmail_user, self.gmail_app_password, self.recipient_email]):
|
||||
raise ValueError("Missing required environment variables")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user