code.gitea.io/gitea@v1.21.7/contrib/environment-to-ini/README (about)

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