Skip to content

Commit

Permalink
move env QR_CODE_MAX_UPLOAD_LENGTH to runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek committed Jan 15, 2024
1 parent 07f4281 commit bd2ab2f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 0 additions & 4 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ config :qrstorage, QrstorageWeb.Endpoint,
layout: false
]

# This is what will be used for the calculation on the client side. We add a buffer to account for deltas
# and overhead in the endpoint configuration, so the server actually allows for a bit more:
config :qrstorage, max_upload_length: System.get_env("QR_CODE_MAX_UPLOAD_LENGTH", "2666666")

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
Expand Down
4 changes: 4 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ config :qrstorage, Qrstorage.Repo,
ssl: System.get_env("DATABASE_SSL", "true") == "true",
socket_options: maybe_ipv6

# This is what will be used for the calculation on the client side. We add a buffer to account for deltas
# and overhead in the endpoint configuration, so the server actually allows for a bit more:
config :qrstorage, max_upload_length: System.get_env("QR_CODE_MAX_UPLOAD_LENGTH", "2666666")

# Set possible translations
default_locale =
case config_env() do
Expand Down
13 changes: 7 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ services:
target: development
tty: true
environment:
DATABASE_USER: ${POSTGRES_USER:-postgres}
DATABASE_USER_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
DATABASE_USER: ${POSTGRES_USER:-qrstorage-user}
DATABASE_USER_PASSWORD: ${POSTGRES_PASSWORD:-qrstorage-password}
DATABASE_NAME: ${POSTGRES_DB:-qrstorage_dev}
DATABASE_PORT: 5432
DATABASE_HOST: postgres
DATABASE_SSL: "false"
QR_CODE_DEFAULT_LOCALE: "de"
QR_CODE_MAX_UPLOAD_LENGTH: 866666
GCP_CONFIG_PATH: ".gcp-config.json"
# Please create a new secret for production runs:
# - Use `mix phx.gen.secret` if you have elixir and phoenix installed
Expand Down Expand Up @@ -78,11 +79,11 @@ services:
# - ./.gcp-config.json:/app/.gcp-config.json

postgres:
image: postgres:12-alpine
image: postgres:15-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-qrstorage_dev}
POSTGRES_USER: ${POSTGRES_USER:-qrstorage-user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-qrstorage-password}
POSTGRES_DB: ${POSTGRES_DB:-qrstorage-dev}
PGDATA: /var/lib/postgresql/data/pgdata
restart: always
# Exposing the port is not needed unless you want to access this database instance from the host.
Expand Down

0 comments on commit bd2ab2f

Please sign in to comment.