From 27e1cccaf8792c95af616c4252898fede7ae85a3 Mon Sep 17 00:00:00 2001 From: Tine Date: Mon, 19 Feb 2024 10:17:32 +0100 Subject: [PATCH] docs: env cleanup --- example.env | 20 +++++++++++++------- internal/config/worker.go | 2 +- justfile | 8 ++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/example.env b/example.env index 896d376..56d764d 100644 --- a/example.env +++ b/example.env @@ -1,11 +1,18 @@ -# Zdravko -PORT=8000 -ROOT_URL=http://localhost:8000 -DATABASE_PATH=zdravko.db +# For all configuration options see: +# internal/config/server.go +# internal/config/worker.go +# internal/config/temporal.go + +# Server SESSION_SECRET=your_secret -# Temporal -TEMPORAL_DATABASE_PATH=temporal.db +# To generate keys, run "just generate-jwt-key" +JWT_PUBLIC_KEY="" +JWT_PRIVATE_KEY="" + +# To generate worker token, go to website and +# create new worker. Then copy the token. +WORKER_TOKEN="" # OAUTH2 # The redirect/callback url is ${ROOT_URL}/oauth2/callback @@ -14,4 +21,3 @@ OAUTH2_CLIENT_SECRET=your_client_secret OAUTH2_ENDPOINT_TOKEN_URL=https://your_oauth2_provider/token OAUTH2_ENDPOINT_AUTH_URL=https://your_oauth2_provider/auth OAUTH2_ENDPOINT_USER_INFO_URL=https://your_oauth2_provider/userinfo -OAUTH2_ENDPOINT_USER_INFO_URL=https://your_oauth2_provider/logout diff --git a/internal/config/worker.go b/internal/config/worker.go index c3f2a80..87f30f1 100644 --- a/internal/config/worker.go +++ b/internal/config/worker.go @@ -18,7 +18,7 @@ func NewWorkerConfig() *WorkerConfig { // Set defaults v.SetDefault("token", os.Getenv("WORKER_TOKEN")) - v.SetDefault("apiurl", os.Getenv("WORKER_API_URL")) + v.SetDefault("apiurl", GetEnvOrDefault("WORKER_API_URL", "http://localhost:8000")) err := v.ReadInConfig() if err != nil { diff --git a/justfile b/justfile index 7b46b7e..2d24def 100644 --- a/justfile +++ b/justfile @@ -34,11 +34,11 @@ generate-jwt-key: openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem # Deploy the application to fly.io -deploy: +deploy-fly: fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}} # Read local jwt key and set it as fly secret -deploy-set-jwt-key-secrets: +deploy-fly-set-jwt-key-secrets: #!/bin/bash # https://github.com/superfly/flyctl/issues/589 cat <