Beispiel #1
0
    defc = '{}/openpgp_api_proxy.conf'.format(os.getcwd())
    parser = argparse.ArgumentParser()
    parser.add_argument("-c",
                        "--config",
                        default=defc,
                        help="Config file path ({})".format(defc))
    parser.add_argument("--version",
                        help="Show version and paths",
                        action="store_true")
    parser.add_argument("-D",
                        "--dump",
                        help="Dumps configuration",
                        action="store_true")
    args = parser.parse_args()

    Config.loadConfigFile(filename=args.config)
    cfg = Config.read()
    if args.version:
        print("Version: {}".format(VERSION))
        print("Config file: {}".format(args.config))

    if args.dump:
        pprint(cfg)

    if args.dump or args.version:
        sys.exit(0)

    proxy_app = Flask(__name__)
    api = Api(proxy_app, default_mediatype=cfg['content-type'])
    api.representations[cfg['content-type']] = openpgp_repr_func
    api.add_resource(