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 # For all configuration options see:
PORT=8000 # internal/config/server.go
ROOT_URL=http://localhost:8000 # internal/config/worker.go
DATABASE_PATH=zdravko.db # internal/config/temporal.go
# Server
SESSION_SECRET=your_secret SESSION_SECRET=your_secret
# Temporal # To generate keys, run "just generate-jwt-key"
TEMPORAL_DATABASE_PATH=temporal.db JWT_PUBLIC_KEY=""
JWT_PRIVATE_KEY=""
# To generate worker token, go to website and
# create new worker. Then copy the token.
WORKER_TOKEN=""
# OAUTH2 # OAUTH2
# The redirect/callback url is ${ROOT_URL}/oauth2/callback # 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_TOKEN_URL=https://your_oauth2_provider/token
OAUTH2_ENDPOINT_AUTH_URL=https://your_oauth2_provider/auth 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/userinfo
OAUTH2_ENDPOINT_USER_INFO_URL=https://your_oauth2_provider/logout

View file

@ -18,7 +18,7 @@ func NewWorkerConfig() *WorkerConfig {
// Set defaults // Set defaults
v.SetDefault("token", os.Getenv("WORKER_TOKEN")) 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() err := v.ReadInConfig()
if err != nil { if err != nil {

View file

@ -34,11 +34,11 @@ generate-jwt-key:
openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem
# Deploy the application to fly.io # Deploy the application to fly.io
deploy: deploy-fly:
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}} fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
# Read local jwt key and set it as fly secret # Read local jwt key and set it as fly secret
deploy-set-jwt-key-secrets: deploy-fly-set-jwt-key-secrets:
#!/bin/bash #!/bin/bash
# https://github.com/superfly/flyctl/issues/589 # https://github.com/superfly/flyctl/issues/589
cat <<EOF | fly secrets import -c deploy/fly.toml cat <<EOF | fly secrets import -c deploy/fly.toml
@ -46,6 +46,10 @@ deploy-set-jwt-key-secrets:
JWT_PUBLIC_KEY="""{{JWT_PUBLIC_KEY}}""" JWT_PUBLIC_KEY="""{{JWT_PUBLIC_KEY}}"""
EOF EOF
# Deploy locally with docker compose
deploy-docker:
cd deploy && docker compose up
# Build the application # Build the application
build: build:
docker build -f build/Dockerfile -t {{DOCKER_IMAGE}} . docker build -f build/Dockerfile -t {{DOCKER_IMAGE}} .