|
|
Mads Kiilerich
|
e9521559d013
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
04c8edacc3a1
|
5 years ago
|
|
cli: in runtime_wrapper for config file handling, don't return unused command handler value
Return values are not used - we should use sys.exit or similar to set command return codes.
|
|
|
Mads Kiilerich
|
cd8d45d4c3cd
|
5 years ago
|
|
config: only assign kallitha.CONFIG once and keep it as a plain dict
Mute pytype warnings and make code more readable for developers:
File "kallithea/lib/hooks.py", line 318, in _hook_environment: No attribute 'global_conf' on Dict[nothing, nothing] [attribute-error] File "kallithea/lib/hooks.py", line 318, in _hook_environment: No attribute 'local_conf' on Dict[nothing, nothing] [attribute-error] File "kallithea/bin/kallithea_cli_base.py", line 82, in runtime_wrapper: No attribute 'global_conf' on Dict[nothing, nothing] [attribute-error] File "kallithea/bin/kallithea_cli_base.py", line 82, in runtime_wrapper: No attribute 'local_conf' on Dict[nothing, nothing] [attribute-error]
|
|
|
Mads Kiilerich
|
3070f9bc6ebe
|
5 years ago
|
|
cli: refactor db_create to avoid app initialization in multiple places
Make sure kallithea.config.application.make_app only is invoked at a high level ... and avoid references to kallithea.CONFIG.global_conf right before kallithea.CONFIG is set to a plain dict again.
Click commands that have both needs_config_file=True and config_file_initialize_app=True will now be called twice - first time before setting kallithea.CONFIG but with the config dict as parameter.
That seems kind of intuitive and will simplify the code and allow cleanup of config handling.
Mute pytype warning:
File "kallithea/bin/kallithea_cli_db.py", line 73, in db_create: No attribute 'global_conf' on Dict[nothing, nothing] [attribute-error] File "kallithea/bin/kallithea_cli_db.py", line 73, in db_create: No attribute 'local_conf' on Dict[nothing, nothing] [attribute-error]
|
|
|
Mads Kiilerich
|
d435713db775
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
3a02b678b5e7
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
eb6ffd819900
|
6 years ago
|
|
py3: fix kallithea-cli ini parsing after ConfigParser got strict=True
ConfigParser in py3 defaults to strict=True and would thus reject our ssh logging hack of renaming config sections ... which cause duplicate section names.
Fortunately, fileConfig now also allows passing a ConfigParser, and we can avoid using io.StringIO .
|
|
|
Mads Kiilerich
|
a8c8b32aee5a
|
6 years ago
|
|
cli: fix missing import of kallithea.config.middleware
Don't rely on other imports making it available as side effect.
|
|
|
Mads Kiilerich
|
e488be112e5e
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
8f468d08f463
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
7fdefd3c5bd5
|
6 years ago
|
|
cache: drop setup_cache_regions - tg will already have done that and coerced the types correctly
The configuration and type fixing will be invoked from make_base_app, and we will thus not have to do it:
File "kallithea/config/middleware.py", line 31, in make_app_without_logging return make_base_app(global_conf, full_stack=full_stack, **app_conf) File ".../python3.7/site-packages/tg/configuration/app_config.py", line 176, in make_base_app wrap_app) File ".../python3.7/site-packages/tg/configurator/application.py", line 112, in _make_app app = TGApp(conf) File ".../python3.7/site-packages/tg/wsgiapp.py", line 49, in __init__ app_wrapper = wrapper(self.wrapped_dispatch, self.config) File ".../python3.7/site-packages/tg/appwrappers/caching.py", line 36, in __init__ self.options = parse_cache_config_options(config) File ".../python3.7/site-packages/beaker/util.py", line 430, in parse_cache_config_options
This will fix a py3 problem where setup_cache_regions was run *after* beaker had coerced types, thus introducing string types in the config where beaker expected the integers it had put there.
|
|
|
Wolfgang Scherer
|
488b52cad890
|
6 years ago
|
|
logging: always invoke fileConfig with '__file__' and 'here'
WSGI servers tend to provide '__file__' and 'here' as 'defaults' when invoking fileConfig, so '%(here)s' string interpolation also can be used in logging configuration.
Make sure we do the same when we initialize logging without using a WSGI server.
It is annoying to have to do this, and it will only in rare cases make any difference ... but it seems like the best option.
Patch also modified by Mads Kiilerich.
|
|
|
Mads Kiilerich
|
0cfd77281853
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
0a277465fddf
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
efd088f7903b
|
6 years ago
|
|
kallithea-cli: introduce generic custom logging configuration for each cli command
Command line commands have different needs for logging than the server process.
To enable that use case, allow config sections to be enabled (and thus augment existing sections), depending on which kallithea-cli command is running.
|
|
|
Mads Kiilerich
|
a185042de98a
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
6956cd0d6063
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
d89217cca11a
|
6 years ago
|
|
cli: introduce -h alias for --help
Very convenient for muscle memory ...
|
|
|
Thomas De Schampheleire
|
e4b9a1d1fea1
|
7 years ago
|
|
cli: initial introduction of 'kallithea-cli' command This commit adds a command 'kallithea-cli' that intends to replace the existing set of 'gearbox' commands that relate to setting up kallithea. Gearbox would still be used for 'gearbox serve', but other commands like 'make-config', 'setup-db', etc. would be converted to 'kallithea-cli' commands. The python package 'Click' is used to generate the CLI. Using decorators, this package makes it very easy to generate a CLI out of simple methods. See: http://click.pocoo.org/7/Using Gearbox for custom commands is possible, but documentation on this topic is limited. As the added value of Gearbox for that use case is not clear, we can well switch to something else if it seems better/easier.
|