Skip to content

Commit

Permalink
Allow unsetting the host name env OPENPROJECT_HOST__NAME (#148)
Browse files Browse the repository at this point in the history
* Do not always output OPENPROJECT_HOST__NAME

This would break a tenant switching deployment

* Allow unsetting the host name env
  • Loading branch information
oliverguenther authored Oct 23, 2024
1 parent 7b78e0b commit 9a71b28
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clean-apes-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openproject/helm-charts": minor
---

Allow unsetting the host name env
2 changes: 1 addition & 1 deletion charts/openproject/templates/secret_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stringData:
OPENPROJECT_SEED_LOCALE: {{ .Values.openproject.seed_locale | quote }}
{{- if .Values.ingress.enabled }}
OPENPROJECT_HOST__NAME: {{ .Values.openproject.host | default .Values.ingress.host | quote }}
{{- else }}
{{- else if .Values.openproject.host -}}
OPENPROJECT_HOST__NAME: {{ .Values.openproject.host | quote }}
{{- end }}
OPENPROJECT_HSTS: {{ .Values.openproject.hsts | quote }}
Expand Down
49 changes: 49 additions & 0 deletions spec/charts/openproject/host_name_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true
require 'spec_helper'

describe 'host name configuration' do
let(:template) { HelmTemplate.new(default_values) }

subject { template.dig('Secret/optest-openproject-core', 'stringData') }

context 'when setting host' do
let(:default_values) do
HelmTemplate.with_defaults(<<~YAML
openproject:
host: bla.example.com
YAML
)
end

it 'adds a respective ENV', :aggregate_failures do
expect(subject)
.to include("OPENPROJECT_HOST__NAME" => "bla.example.com")
end
end

context 'when setting no host name but leaving ingress enabled' do
let(:default_values) do
HelmTemplate.with_defaults({})
end

it 'the host name is the default', :aggregate_failures do
expect(subject)
.to include("OPENPROJECT_HOST__NAME" => "openproject.example.com")
end
end

context 'when setting no host name and disabling ingress' do
let(:default_values) do
HelmTemplate.with_defaults(<<~YAML
ingress:
enabled: false
YAML
)
end

it 'the host is not output', :aggregate_failures do
expect(subject.keys)
.not_to include("OPENPROJECT_HOST__NAME")
end
end
end

0 comments on commit 9a71b28

Please sign in to comment.