مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
feat: add helm env var config exporter
هذا الالتزام موجود في:
28
lib/postal/helm_config_exporter.rb
Normal file
28
lib/postal/helm_config_exporter.rb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "konfig/exporters/abstract"
|
||||||
|
|
||||||
|
module Postal
|
||||||
|
class HelmConfigExporter < Konfig::Exporters::Abstract
|
||||||
|
|
||||||
|
def export
|
||||||
|
contents = []
|
||||||
|
|
||||||
|
path = []
|
||||||
|
|
||||||
|
@schema.groups.each do |group_name, group|
|
||||||
|
path << group_name
|
||||||
|
group.attributes.each do |name, attr|
|
||||||
|
env_var = Konfig::Sources::Environment.path_to_env_var(path + [name])
|
||||||
|
contents << <<~VAR.strip
|
||||||
|
{{ include "app.envVar" (dict "name" "#{env_var}" "spec" .Values.postal.#{path.join('.')}.#{name} "root" . ) }}
|
||||||
|
VAR
|
||||||
|
end
|
||||||
|
path.pop
|
||||||
|
end
|
||||||
|
|
||||||
|
contents.join("\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -22,6 +22,11 @@ namespace :postal do
|
|||||||
output = Postal::YamlConfigExporter.new(Postal::ConfigSchema).export
|
output = Postal::YamlConfigExporter.new(Postal::ConfigSchema).export
|
||||||
File.write("doc/config/yaml.yml", output)
|
File.write("doc/config/yaml.yml", output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Generate Helm Environment Variables"
|
||||||
|
task generate_helm_env_vars: :environment do
|
||||||
|
puts Postal::HelmConfigExporter.new(Postal::ConfigSchema).export
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Rake::Task["db:migrate"].enhance do
|
Rake::Task["db:migrate"].enhance do
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم