プロジェクト

全般

プロフィール

Vote #81878

未完了

Load and use bash/system ENV variables in config YML files

Admin Redmine さんが3年以上前に追加.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
-
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
0
version_id:
0
issue_org_id:
36852
author_id:
5107
assigned_to_id:
0
comments:
3
status_id:
1
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

In some scenarios, where Redmine is automatically deployed,
it would be of good use to read EXPORT or ENV variables and use them in config .yml files like database.yml

For example like elsastic
https://www.elastic.co/guide/en/beats/winlogbeat/current/using-environ-vars.html

export DB-NAME = "something" 

and in yml file

production:
  database: ${DB-NAME}


journals

I am referring to setup, with rake task.

--------------------------------------------------------------------------------
There are some hacks like this:
https://stackoverflow.com/questions/15045369/redmine-email-configuration-with-environment-variables

But it would be better to be officially supported.
--------------------------------------------------------------------------------
You can use ERB tags in your @database.yml@, for example:
<pre>
production:
database: "<%= ENV["PRODUCTION_DATABASE"] %>"
</pre>

From https://edgeguides.rubyonrails.org/configuring.html#configuring-a-database
> The config/database.yml file can contain ERB tags <%= %>. Anything in the tags will be evaluated as Ruby code. You can use this to pull out data from an environment variable or to perform calculations to generate the needed connection information.

--------------------------------------------------------------------------------

表示するデータがありません

他の形式にエクスポート: Atom PDF

いいね!0