summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--conf/db.jsonbin0 -> 175 bytes
-rw-r--r--rcal/db.py11
3 files changed, 12 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..e61e4e2
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+conf/db.json filter=git-crypt diff=git-crypt
diff --git a/conf/db.json b/conf/db.json
new file mode 100644
index 0000000..1c13879
--- /dev/null
+++ b/conf/db.json
Binary files differ
diff --git a/rcal/db.py b/rcal/db.py
new file mode 100644
index 0000000..3e74c4e
--- /dev/null
+++ b/rcal/db.py
@@ -0,0 +1,11 @@
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+import json, __main__
+from os import path
+
+config = json.load(
+ open(path.join(path.dirname(__main__.__file__), 'conf', 'db.json')))
+engine = create_engine(
+ "{0[type]}://{0[user]}:{0[pass]}@{0[host]}/{0[name]}?{0[opts]}".format(config))
+
+Session = sessionmaker(bind=engine)