[Bugfix] Fix basic auth in deployed apps (#52)

* Renamed auth env vars and updated them to work in prod env

* Updated basic auth parsing to ignore empty strings
This commit is contained in:
Kieran
2024-03-04 18:29:26 -08:00
committed by GitHub
parent a4f4afeac9
commit 82eb12b983
5 changed files with 22 additions and 5 deletions
+3 -3
View File
@@ -17,10 +17,10 @@ config :pinchflat,
# The user may or may not store metadata for their needs, but the app will always store its copy
metadata_directory: "/config/metadata",
tmpfile_directory: Path.join([System.tmp_dir!(), "pinchflat", "data"]),
# Setting AUTH_USERNAME and AUTH_PASSWORD implies you want to use basic auth.
# Setting BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD implies you want to use basic auth.
# If either is unset, basic auth will not be used.
basic_auth_username: System.get_env("AUTH_USERNAME"),
basic_auth_password: System.get_env("AUTH_PASSWORD"),
basic_auth_username: System.get_env("BASIC_AUTH_USERNAME"),
basic_auth_password: System.get_env("BASIC_AUTH_PASSWORD"),
file_watcher_poll_interval: 1000
# Configures the endpoint
+4
View File
@@ -21,6 +21,10 @@ if System.get_env("PHX_SERVER") do
config :pinchflat, PinchflatWeb.Endpoint, server: true
end
config :pinchflat,
basic_auth_username: System.get_env("BASIC_AUTH_USERNAME"),
basic_auth_password: System.get_env("BASIC_AUTH_PASSWORD")
if config_env() == :prod do
config_path =
System.get_env("CONFIG_PATH") ||