Skip to content

Commit

Permalink
Enable rubyconfig to work with array ENV variables
Browse files Browse the repository at this point in the history
With this flag set environment variables with sequential suffixes can be used to set array Settings.

For example,
```
export SETTINGS__BIB_RETRIEVER__DEFAULT__QUERY__0="cql.serverChoice='^C%{bib_id}'"
export SETTINGS__BIB_RETRIEVER__DEFAULT__QUERY__1="cql.serverChoice exact '%{bib_id}'"
export SETTINGS__BIB_RETRIEVER__DEFAULT__QUERY__2="cql.serverChoice='%{bib_id}'"
```
will result in
```
Settings.bib_retriever.default.query
# ["cql.serverChoice='^C%{bib_id}'", "cql.serverChoice exact '%{bib_id}'", "cql.serverChoice='%{bib_id}'"]
```
  • Loading branch information
cjcolvar authored Sep 10, 2024
1 parent 24cdb9a commit 5263e6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/initializers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@

# Parse numeric values as integers instead of strings.
config.env_parse_values = true

# Allow env variables for array settings
config.env_parse_arrays = true
end

0 comments on commit 5263e6a

Please sign in to comment.