<s> from oslo_config import cfg <EOL> import oslo_middleware . cors as cors_middleware <EOL> import pecan <EOL> from solum . api import auth <EOL> from solum . api import config as api_config <EOL> API_SERVICE_OPTS = [ <EOL> cfg . IntOpt ( '<STR_LIT:port>' , <EOL> default = <NUM_LIT> , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT:host>' , <EOL> default = '<STR_LIT:127.0.0.1>' , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT:10> , <EOL> help = '<STR_LIT>' ) , <EOL> ] <EOL> API_PLAN_OPTS = [ <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT> , <EOL> help = '<STR_LIT>' ) , <EOL> ] <EOL> CONF = cfg . CONF <EOL> opt_group = cfg . OptGroup ( name = '<STR_LIT>' , <EOL> title = '<STR_LIT>' ) <EOL> def list_opts ( ) : <EOL> yield '<STR_LIT>' , API_SERVICE_OPTS <EOL> yield None , API_PLAN_OPTS <EOL> CONF . register_group ( opt_group ) <EOL> CONF . register_opts ( API_SERVICE_OPTS , opt_group ) <EOL> CONF . register_opts ( API_PLAN_OPTS ) <EOL> def get_pecan_config ( ) : <EOL> filename = api_config . __file__ . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> return pecan . configuration . conf_from_file ( filename ) <EOL> def setup_app ( config = None ) : <EOL> if not config : <EOL> config = get_pecan_config ( ) <EOL> app_conf = dict ( config . app ) <EOL> app = pecan . make_app ( <EOL> app_conf . pop ( '<STR_LIT:root>' ) , <EOL> logging = getattr ( config , '<STR_LIT>' , { } ) , <EOL> ** app_conf <EOL> ) <EOL> app = auth . install ( app , CONF ) <EOL> app = cors_middleware . CORS ( app , CONF ) <EOL> return app </s>
