def convert_to_gunicorn_config()

in src/ab/apps/gunicorn.py [0:0]


    def convert_to_gunicorn_config(self, config):
        # ab & flask config to gunicorn config
        new_bind = config['HOST'] + ':' + str(config['PORT'])
        if 'bind' in config and config['bind'] != new_bind:
            logger.warning('overwrite gunicorn bind address "{bind}" by "{new_bind}"'.format(
                bind=config['bind'], new_bind=new_bind))
        config['bind'] = new_bind

        if 'proc_name' in config and config['proc_name'] != config['APP_NAME']:
            logger.warning('overwrite gunicorn proc_name "{proc_name}" by "{app_name}"'.format(
                proc_name=config['proc_name'], app_name=config['APP_NAME']
            ))
        config['proc_name'] = config['APP_NAME']

        if 'LOG_LEVEL' in config:
            if 'loglevel' in config and config['loglevel'] != config['LOG_LEVEL']:
                logger.warning('overwrite gunicorn loglevel "{loglevel}" by "{new_loglevel}"'.format(
                    loglevel=config['loglevel'], new_loglevel=config['LOG_LEVEL']
                ))
            config['loglevel'] = config['LOG_LEVEL']

        if 'debug' in config and config['debug'] != config['DEBUG']:
            logger.warning('overwrite gunicorn debug "{debug}" by "{new_debug}"'.format(
                debug=config['debug'], new_debug=config['DEBUG']
            ))
        config['debug'] = config['DEBUG']

        for hook_name, default_hook in self.default_hooks.items():
            if hook_name not in config:
                # default hook not set, use the default one
                config[hook_name] = default_hook
                continue

            # # combine default and user-defined hook
            def combined_hook(**kwargs):
                default_hook(**kwargs)
                config[hook_name](**kwargs)

            config[hook_name] = combined_hook

        # return gunicorn config kv
        return {k: v for k, v in config.items() if k in self.cfg.settings}