docs: env cleanup

This commit is contained in:
Tine 2024-02-19 10:17:32 +01:00
parent 527d9dadd3
commit 27e1cccaf8
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
3 changed files with 20 additions and 10 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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 <<EOF | fly secrets import -c deploy/fly.toml
@ -46,6 +46,10 @@ deploy-set-jwt-key-secrets:
JWT_PUBLIC_KEY="""{{JWT_PUBLIC_KEY}}"""
EOF
# Deploy locally with docker compose
deploy-docker:
cd deploy && docker compose up
# Build the application
build:
docker build -f build/Dockerfile -t {{DOCKER_IMAGE}} .