Files
openproject/config/database.production.yml
2025-07-28 16:52:04 +02:00

89 lines
2.4 KiB
YAML

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
<%
database_options = %w[
url
database
encoding
pool
username
password
passfile
sslmode
sslcompression
sslcert
sslkey
sslpassword
sslrootcert
sslcrl
ssl_min_protocol_version
application_name
statement_timeout
channel_binding
connect_timeout
client_encoding
keepalives
keepalives_idle
keepalives_interval
keepalives_count
gssencmode
replication
]
database_variables = %w[
statement_timeout
]
database_defaults = {
# Fallback to unprefixed DATABASE_URL if present
'url' => ENV['DATABASE_URL'],
'statement_timeout' => ENV.fetch("POSTGRES_STATEMENT_TIMEOUT", "90s"),
'encoding' => 'unicode',
'application_name' => 'openproject',
}
%>
production:
adapter: postgresql
<% database_options.each do |option| %>
<% env_name = "OPENPROJECT_DB_#{option.upcase}" %>
<% value = ENV.fetch(env_name, database_defaults[option]) %>
<% unless value.nil? %>
<%= option %>: <%= value %>
<% end %>
<% end %>
variables:
<% database_variables.each do |option| %>
<% env_name = "OPENPROJECT_DB_#{option.upcase}" %>
<% value = ENV.fetch(env_name, database_defaults[option]) %>
<% unless value.nil? %>
<%= option %>: <%= value %>
<% end %>
<% end %>