From 347843cb247e0c4c3710f65a486c502b994f7be1 Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 19 Feb 2020 10:22:15 +0500 Subject: [PATCH] Sample config file added + uncloud dependency removed --- etcd_wrapper.py | 14 +++++++------- sample-pay.conf | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 sample-pay.conf diff --git a/etcd_wrapper.py b/etcd_wrapper.py index 9624677..0f55271 100644 --- a/etcd_wrapper.py +++ b/etcd_wrapper.py @@ -1,11 +1,9 @@ import etcd3 import json +import logging from functools import wraps -from uncloud import UncloudException -from uncloud.common import logger - class EtcdEntry: def __init__(self, meta_or_key, value, value_in_json=True): @@ -26,12 +24,14 @@ def readable_errors(func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) - except etcd3.exceptions.ConnectionFailedError: - raise UncloudException('Cannot connect to etcd: is etcd running as configured in uncloud.conf?') + except etcd3.exceptions.ConnectionFailedError as err: + raise etcd3.exceptions.ConnectionFailedError( + 'Cannot connect to etcd: is etcd running as configured in uncloud.conf?' + ) from err except etcd3.exceptions.ConnectionTimeoutError as err: raise etcd3.exceptions.ConnectionTimeoutError('etcd connection timeout.') from err - except Exception as err: - logger.exception('Some etcd error occured. See syslog for details.', err) + except Exception: + logging.exception('Some etcd error occured. See syslog for details.') return wrapper diff --git a/sample-pay.conf b/sample-pay.conf new file mode 100644 index 0000000..bed5dbe --- /dev/null +++ b/sample-pay.conf @@ -0,0 +1,19 @@ +[etcd] +host = 127.0.0.1 +port = 2379 + +[stripe] +private_key=stripe_private_key + +[app] +port = 5000 + +[ldap] +server = ldap_server_url +admin_dn = ldap_admin_dn +admin_password = ldap_admin_password +customer_dn = ldap_customer_dn +user_dn = ldap_user_dn + +internal_user_ou = users +customer_ou = customer \ No newline at end of file