From cde37d1679159f5cba47a784ee25cee905b7df10 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 14 Dec 2019 07:32:33 +0100 Subject: [PATCH] Add settings for SMTP --- .env.example | 9 +++++++++ internal/app/app.go | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 5f7d2db..84fe243 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,10 @@ DATABASE_DSN="postgres://user:password@127.0.0.1:5432/database?sslmode=disable" +S3_ENDPOINT="https://sfo2.spaces.digitalocean.com" +S3_KEY="URVEXAMPLETOKENN/IAWG3" +S3_SECRET="9examplewbvxsvobzunvqwdenvhws" +S3_LOCATION="sfo2" +S3_SSL=true +S3_BUCKET="bucket" +SMTP_SERVER="smtp.example.com" +SMTP_USER="user@example.com" +SMTP_PASS="password" diff --git a/internal/app/app.go b/internal/app/app.go index 86f3116..f7d7246 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -4,24 +4,27 @@ import ( "net/http" "sync" - "github.com/caarlos0/env" - "github.com/jmoiron/sqlx" "bitmask.me/skeleton/assets" "bitmask.me/skeleton/internal/database" "bitmask.me/skeleton/internal/storage" "bitmask.me/skeleton/internal/templates" + "github.com/caarlos0/env" + "github.com/jmoiron/sqlx" ) // Config contains all neccessary configuration for the App type Config struct { DatabaseDSN string `env:"DATABASE_DSN"` - S3Key string `env:"S3_KEY"` - S3Secret string `env:"S3_SECRET"` - S3Location string `env:"S3_LOCATION"` - S3Endpoint string `env:"S3_ENDPOINT"` - S3SSL bool `env:"S3_SSL"` - S3Bucket string `env:"S3_BUCKET"` + S3Key string `env:"S3_KEY"` + S3Secret string `env:"S3_SECRET"` + S3Location string `env:"S3_LOCATION"` + S3Endpoint string `env:"S3_ENDPOINT"` + S3SSL bool `env:"S3_SSL"` + S3Bucket string `env:"S3_BUCKET"` + SMTPServer string `env:"SMTP_SERVER"` + SMTPUser string `env:"SMTP_USER"` + SMTPPassword string `env:"SMTP_PASS"` } // ConfigFromEnv loads the configuration from environment variables