Skip to content

Commit cab7f3d

Browse files
pat-stechknowlogick
authored and
techknowlogick
committed
Change env-to-ini prefix and remove custom prefix (#464)
### Description of the change Change env-to-ini prefix and remove custom prefix. `GITEA` is the default prefix. ### Benefits Compatibility wit v1.20 (`-p` got removed) ### Possible drawbacks None ### Additional information See go-gitea/gitea#25799 Tested with Gitea < 1.20 and >= 1.20 Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/464 Co-authored-by: pat-s <patrick.schratz@gmail.com> Co-committed-by: pat-s <patrick.schratz@gmail.com>
1 parent ca76cc5 commit cab7f3d

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,14 @@ We also support to directly interact with the generated _app.ini_.
237237
To inject self defined variables into the _app.ini_ a certain format needs to be honored.
238238
This is described in detail on the [env-to-ini](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini) page.
239239

240-
Note that the Prefix on this helm chart is `ENV_TO_INI`.
241-
242240
For example a database setting needs to have the following format:
243241

244242
```yaml
245243
gitea:
246244
additionalConfigFromEnvs:
247-
- name: ENV_TO_INI__DATABASE__HOST
245+
- name: GITEA__DATABASE__HOST
248246
value: my.own.host
249-
- name: ENV_TO_INI__DATABASE__PASSWD
247+
- name: GITEA__DATABASE__PASSWD
250248
valueFrom:
251249
secretKeyRef:
252250
name: postgres-secret
@@ -255,7 +253,7 @@ gitea:
255253

256254
Priority (highest to lowest) for defining app.ini variables:
257255

258-
1. Environment variables prefixed with `ENV_TO_INI`
256+
1. Environment variables prefixed with `GITEA`
259257
1. Additional config sources
260258
1. Values defined in `gitea.config`
261259

templates/gitea/config.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ stringData:
5353
env2ini::log " + '${setting}'"
5454
5555
if [[ -z "${section}" ]]; then
56-
export "ENV_TO_INI____${setting^^}=${value}" # '^^' makes the variable content uppercase
56+
export "GITEA____${setting^^}=${value}" # '^^' makes the variable content uppercase
5757
return
5858
fi
5959
6060
local masked_section="${section//./_0X2E_}" # '//' instructs to replace all matches
6161
masked_section="${masked_section//-/_0X2D_}"
6262
63-
export "ENV_TO_INI__${masked_section^^}__${setting^^}=${value}" # '^^' makes the variable content uppercase
63+
export "GITEA__${masked_section^^}__${setting^^}=${value}" # '^^' makes the variable content uppercase
6464
}
6565
6666
function env2ini::reload_preset_envs() {
@@ -134,15 +134,15 @@ stringData:
134134
# - initially used to set up Gitea
135135
# Anyway, they won't harm existing app.ini files
136136
137-
export ENV_TO_INI__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN)
138-
export ENV_TO_INI__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY)
139-
export ENV_TO_INI__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET)
140-
export ENV_TO_INI__SERVER__LFS_JWT_SECRET=$(gitea generate secret LFS_JWT_SECRET)
137+
export GITEA__SECURITY__INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN)
138+
export GITEA__SECURITY__SECRET_KEY=$(gitea generate secret SECRET_KEY)
139+
export GITEA__OAUTH2__JWT_SECRET=$(gitea generate secret JWT_SECRET)
140+
export GITEA__SERVER__LFS_JWT_SECRET=$(gitea generate secret LFS_JWT_SECRET)
141141
142142
env2ini::log "...Initial secrets generated\n"
143143
}
144144
145-
env | (grep ENV_TO_INI || [[ $? == 1 ]]) > /tmp/existing-envs
145+
env | (grep GITEA || [[ $? == 1 ]]) > /tmp/existing-envs
146146
147147
# MUST BE CALLED BEFORE OTHER CONFIGURATION
148148
env2ini::generate_initial_secrets
@@ -163,10 +163,10 @@ stringData:
163163
env2ini::log ' - oauth2.JWT_SECRET'
164164
env2ini::log ' - server.LFS_JWT_SECRET'
165165
166-
unset ENV_TO_INI__SECURITY__INTERNAL_TOKEN
167-
unset ENV_TO_INI__SECURITY__SECRET_KEY
168-
unset ENV_TO_INI__OAUTH2__JWT_SECRET
169-
unset ENV_TO_INI__SERVER__LFS_JWT_SECRET
166+
unset GITEA__SECURITY__INTERNAL_TOKEN
167+
unset GITEA__SECURITY__SECRET_KEY
168+
unset GITEA__OAUTH2__JWT_SECRET
169+
unset GITEA__SERVER__LFS_JWT_SECRET
170170
fi
171171
172-
environment-to-ini -o $GITEA_APP_INI -p ENV_TO_INI
172+
environment-to-ini -o $GITEA_APP_INI

0 commit comments

Comments
 (0)