Improved fetching SECRET_KEY_BASE for selfhosted instances
This commit is contained in:
parent
5996390776
commit
cec5018d44
2 changed files with 15 additions and 7 deletions
|
|
@ -44,14 +44,21 @@ if config_env() == :prod do
|
||||||
if System.get_env("SECRET_KEY_BASE") do
|
if System.get_env("SECRET_KEY_BASE") do
|
||||||
System.get_env("SECRET_KEY_BASE")
|
System.get_env("SECRET_KEY_BASE")
|
||||||
else
|
else
|
||||||
Logger.warning("""
|
if System.get_env("RUN_CONTEXT") == "selfhosted" do
|
||||||
Using the default SECRET_KEY_BASE in a conventional production environment
|
# Using the default SECRET_KEY_BASE in a conventional production environment
|
||||||
is dangerous. Please set the SECRET_KEY_BASE environment variable if you're
|
# is dangerous. Please set the SECRET_KEY_BASE environment variable if you're
|
||||||
deploying this to an internet-facing server. If you're running this in a
|
# deploying this to an internet-facing server. If you're running this in a
|
||||||
private network, it's likely safe to use the default value.
|
# private network, it's likely safe to use the default value. If you want
|
||||||
""")
|
# to be extra safe, run `mix phx.gen.secret` and set the SECRET_KEY_BASE
|
||||||
|
# environment variable to the output of that command.
|
||||||
|
|
||||||
"ZkuQMStdmUzBv+gO3m3XZrtQW76e+AX3QIgTLajw3b/HkTLMEx+DOXr2WZsSS+n8"
|
"ZkuQMStdmUzBv+gO3m3XZrtQW76e+AX3QIgTLajw3b/HkTLMEx+DOXr2WZsSS+n8"
|
||||||
|
else
|
||||||
|
raise """
|
||||||
|
environment variable SECRET_KEY_BASE is missing.
|
||||||
|
You can generate one by calling: mix phx.gen.secret
|
||||||
|
"""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config :pinchflat, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
|
config :pinchflat, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ VOLUME /downloads
|
||||||
ENV MIX_ENV="prod"
|
ENV MIX_ENV="prod"
|
||||||
ENV DATABASE_PATH="/config/pinchflat.db"
|
ENV DATABASE_PATH="/config/pinchflat.db"
|
||||||
ENV PORT=8945
|
ENV PORT=8945
|
||||||
|
ENV RUN_CONTEXT="selfhosted"
|
||||||
|
|
||||||
# Only copy the final release from the build stage
|
# Only copy the final release from the build stage
|
||||||
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/pinchflat ./
|
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/pinchflat ./
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue