def main(args=sys.argv): parser = argparse.ArgumentParser() parser.add_argument('-f', dest='conffile') kwargs = parser.parse_args(args[1:]) kwargs = vars(kwargs) config_file = kwargs.pop('conffile') Configuration.load(config_file, 'global') consumer = Consumer(Configuration('global').get('broker'), process_message) consumer.start()
def main(args=sys.argv): parser = argparse.ArgumentParser() parser.add_argument('-f', dest='conffile', default='development.ini') subparsers = parser.add_subparsers(title="action") sp_import = subparsers.add_parser('import', help='import existing mailbox') sp_import.set_defaults(func=import_email) sp_import.add_argument('-f', dest='format', choices=['mbox', 'maildir'], default='mbox') sp_import.add_argument('-p', dest='import_path') sp_import.add_argument('-e', dest='email') sp_setup_storage = subparsers.add_parser('setup', help='initialize the storage engine') sp_setup_storage.set_defaults(func=setup_storage) sp_create_user = subparsers.add_parser('create_user', help='Create a new user') sp_create_user.set_defaults(func=create_user) sp_create_user.add_argument('-e', dest='email', help='user email') sp_create_user.add_argument('-p', dest='password', help='password') sp_create_user.add_argument('-g', dest='given_name', help='user given name') sp_create_user.add_argument('-f', dest='family_name', help='user family name') sp_shell = subparsers.add_parser('shell') sp_shell.set_defaults(func=shell) sp_dump = subparsers.add_parser('dump') sp_dump.set_defaults(func=dump_model) sp_dump.add_argument('-m', dest='model', help='model to dump') sp_dump.add_argument('-o', dest='output_path', help='output path') kwargs = parser.parse_args(args[1:]) kwargs = vars(kwargs) config_uri = kwargs.pop('conffile') func = kwargs.pop('func') Configuration.load(config_uri, 'global') connect_storage() func(**kwargs)
def main(global_config, **settings): """Caliopen entry point for WSGI application. Load Caliopen configuration and setup a WSGI application with loaded API services. """ # XXX ugly way to init caliopen configuration before pyramid caliopen_config = settings['caliopen.config'].split(':')[1] Configuration.load(caliopen_config, 'global') config = Configurator(settings=settings) services = config.registry.settings. \ get('caliopen.api.services', []). \ split('\n') route_prefix = settings.get('caliopen.api.route_prefix') for service in services: log.info('Loading %s service' % service) config.include(service, route_prefix=route_prefix) config.end() return config.make_wsgi_app()
# # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os here = os.path.dirname(__file__) from caliopen.base.config import Configuration Configuration.load(os.path.join(here, '..', 'base', 'caliopen.yaml.template'), 'global') # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones.