You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Environment To Ini
  2. ==================
  3. Multiple docker users have requested that the Gitea docker is changed
  4. to permit arbitrary configuration via environment variables.
  5. Gitea needs to use an ini file for configuration because the running
  6. environment that starts the docker may not be the same as that used
  7. by the hooks. An ini file also gives a good default and means that
  8. users do not have to completely provide a full environment.
  9. With those caveats above, this command provides a generic way of
  10. converting suitably structured environment variables into any ini
  11. value.
  12. To use the command is very simple just run it and the default gitea
  13. app.ini will be rewritten to take account of the variables provided,
  14. however there are various options to give slightly different
  15. behavior and these can be interrogated with the `-h` option.
  16. The environment variables should be of the form:
  17. GITEA__SECTION_NAME__KEY_NAME
  18. Note, SECTION_NAME in the notation above is case-insensitive.
  19. Environment variables are usually restricted to a reduced character
  20. set "0-9A-Z_" - in order to allow the setting of sections with
  21. characters outside of that set, they should be escaped as following:
  22. "_0X2E_" for "." and "_0X2D_" for "-". The entire section and key names
  23. can be escaped as a UTF8 byte string if necessary. E.g. to configure:
  24. """
  25. ...
  26. [log.console]
  27. COLORIZE=false
  28. STDERR=true
  29. ...
  30. """
  31. You would set the environment variables: "GITEA__LOG_0x2E_CONSOLE__COLORIZE=false"
  32. and "GITEA__LOG_0x2E_CONSOLE__STDERR=false". Other examples can be found
  33. on the configuration cheat sheet.
  34. To build locally, run:
  35. go build contrib/environment-to-ini/environment-to-ini.go