fix: don't override paths in dockerfile

This allows for these paths to continue to be set in the config file or environment variable while still maintaining the default of having the default paths in the same directory as the postal config file.
This commit is contained in:
Adam Cooke
2024-03-08 16:40:58 +00:00
parent 22dcd4901f
commit 9399e32234
5 changed files with 22 additions and 10 deletions
-3
View File
@@ -48,9 +48,6 @@ RUN echo $VERSION > VERSION
# Set paths for when running in a container # Set paths for when running in a container
ENV POSTAL_CONFIG_FILE_PATH=/config/postal.yml ENV POSTAL_CONFIG_FILE_PATH=/config/postal.yml
ENV POSTAL_SIGNING_KEY_PATH=/config/signing.key
ENV SMTP_SERVER_TLS_CERTIFICATE_PATH=/config/smtp.cert
ENV SMTP_SERVER_TLS_PRIVATE_KEY_PATH=/config/smtp.key
# Set the CMD # Set the CMD
ENTRYPOINT [ "/docker-entrypoint.sh" ] ENTRYPOINT [ "/docker-entrypoint.sh" ]
+1 -1
View File
@@ -16,7 +16,7 @@ gem "hashie"
gem "highline", require: false gem "highline", require: false
gem "kaminari" gem "kaminari"
gem "klogger-logger" gem "klogger-logger"
gem "konfig-config", "~> 2.0" gem "konfig-config", "~> 3.0"
gem "mail" gem "mail"
gem "moonrope" gem "moonrope"
gem "mysql2" gem "mysql2"
+2 -2
View File
@@ -149,7 +149,7 @@ GEM
concurrent-ruby (>= 1.0, < 2.0) concurrent-ruby (>= 1.0, < 2.0)
json json
rouge (>= 3.30, < 5.0) rouge (>= 3.30, < 5.0)
konfig-config (2.1.1) konfig-config (3.0.0)
hashie hashie
loofah (2.22.0) loofah (2.22.0)
crass (~> 1.0.2) crass (~> 1.0.2)
@@ -353,7 +353,7 @@ DEPENDENCIES
jquery-rails jquery-rails
kaminari kaminari
klogger-logger klogger-logger
konfig-config (~> 2.0) konfig-config (~> 3.0)
mail mail
moonrope moonrope
mysql2 mysql2
+16 -3
View File
@@ -68,7 +68,8 @@ module Postal
string :signing_key_path do string :signing_key_path do
description "Path to the private key used for signing" description "Path to the private key used for signing"
default "config/postal/signing.key" default "$config-file-root/signing.key"
transform { |v| Postal.substitute_config_file_root(v) }
end end
string :smtp_relays do string :smtp_relays do
@@ -253,12 +254,14 @@ module Postal
string :tls_certificate_path do string :tls_certificate_path do
description "The path to the SMTP server's TLS certificate" description "The path to the SMTP server's TLS certificate"
default "config/postal/smtp.cert" default "$config-file-root/smtp.cert"
transform { |v| Postal.substitute_config_file_root(v) }
end end
string :tls_private_key_path do string :tls_private_key_path do
description "The path to the SMTP server's TLS private key" description "The path to the SMTP server's TLS private key"
default "config/postal/smtp.key" default "$config-file-root/smtp.key"
transform { |v| Postal.substitute_config_file_root(v) }
end end
string :tls_ciphers do string :tls_ciphers do
@@ -502,4 +505,14 @@ module Postal
end end
end end
class << self
def substitute_config_file_root(string)
return if string.nil?
string.gsub(/\$config-file-root/i, File.dirname(Postal.config_file_path))
end
end
end end
+3 -1
View File
@@ -17,7 +17,9 @@ module Postal
# by the schema itself. Otherwise, we might see a value returned that # by the schema itself. Otherwise, we might see a value returned that
# looks correct but is actually the default rather than the value from # looks correct but is actually the default rather than the value from
# config file. # config file.
allow_any_instance_of(Konfig::SchemaAttribute).to receive(:default).and_return(nil) allow_any_instance_of(Konfig::SchemaAttribute).to receive(:default) do |a|
a.array? ? [] : nil
end
end end
let(:source) { described_class.new(SOURCE_CONFIG) } let(:source) { described_class.new(SOURCE_CONFIG) }