Skip to content

Conversation

@wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Oct 23, 2025

Ref: #32669. Helps addressing https://gitea.com/gitea/helm-chart/issues/356.

  • Keep Specified Keys

If you need to re-create the configuration file with only a subset of keys,
you can provide an INI template file and use the "--config-keep-keys" flag.
For example, if a helm chart needs to reset the settings and only keep SECRET_KEY,
it can use a template file like:

  [security]
  SECRET_KEY=

$ ./gitea config edit-ini --config app-old.ini --config-keep-keys app-template.ini --out app-new.ini

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 23, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/internal labels Oct 23, 2025
@wxiaoguang wxiaoguang added this to the 1.26.0 milestone Oct 23, 2025
@wxiaoguang wxiaoguang added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Oct 23, 2025
@lunny
Copy link
Member

lunny commented Oct 23, 2025

Maybe this is a good opportunity to restrict environment-based configuration to only specific sections.

@wxiaoguang wxiaoguang changed the title Intorduce "config update-ini" sub command to help maintain INI config file Intorduce "config update-ini" sub command to help maintaining INI config file Oct 24, 2025
Copy link
Contributor

@TheFox0x7 TheFox0x7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as the only concern I have are flag name and semi-clear instructions, the latter of which can easily be reworded if someone will have questions about the behavior.
I don't have much better ideas for the flag name though the template part still feels wrong here but naming things always was hard :)

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 24, 2025
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Oct 24, 2025

Applied your suggestions and made new changes:

  • use edit-ini instead of update-ini, "update" sounds like "change the existing thing", "edit" is like sed: edit and save
  • add --in-place flag (also like sed), then we don't need to worry about the input file would be accidentally overwritten.
  • use --config-keep-keys as you suggested.

@wxiaoguang wxiaoguang changed the title Intorduce "config update-ini" sub command to help maintaining INI config file Intorduce "config edit-ini" sub command to help maintaining INI config file Oct 24, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 24, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 24, 2025
@wxiaoguang wxiaoguang merged commit cb72c90 into go-gitea:main Oct 25, 2025
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-env-ini branch October 25, 2025 02:54
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 25, 2025
@wxiaoguang wxiaoguang changed the title Intorduce "config edit-ini" sub command to help maintaining INI config file Introduce "config edit-ini" sub command to help maintaining INI config file Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code modifies/internal type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants