summaryrefslogtreecommitdiff
path: root/yarns/lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/lib.py')
-rw-r--r--yarns/lib.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/yarns/lib.py b/yarns/lib.py
index 9ed7f59..56707ba 100644
--- a/yarns/lib.py
+++ b/yarns/lib.py
@@ -177,15 +177,30 @@ def start_qvisqve():
V['port'] = cliapp.runcmd([os.path.join(srcdir, 'randport' )]).strip()
V['API_URL'] = 'http://127.0.0.1:{}'.format(V['port'])
- clients = {}
+ store = os.path.join(datadir, 'store')
+ os.mkdir(store)
+ os.mkdir(os.path.join(store, 'client'))
+ os.mkdir(os.path.join(store, 'application'))
+
if V['client_id'] and V['client_secret']:
sh = qvisqve_secrets.SecretHasher()
- clients = {
- V['client_id']: {
- 'client_secret': sh.hash(V['client_secret']),
- 'allowed_scopes': V['allowed_scopes'],
- },
+ client = {
+ 'hashed_secret': sh.hash(V['client_secret']),
+ 'allowed_scopes': V['allowed_scopes'],
+ }
+
+ filename = os.path.join(store, 'client', V['client_id'])
+ with open(filename, 'w') as f:
+ yaml.safe_dump(client, stream=f)
+
+ apps = V['applications']
+ for name in apps or []:
+ filename = os.path.join(store, 'application', name)
+ spec = {
+ 'callbacks': [apps[name]],
}
+ with open(filename, 'w') as f:
+ yaml.safe_dump(spec, stream=f)
config = {
'gunicorn': 'background',
@@ -201,8 +216,7 @@ def start_qvisqve():
'token-public-key': V['pubkey'],
'token-issuer': V['iss'],
'token-lifetime': 3600,
- 'clients': clients,
- 'applications': V['applications'] or {},
+ 'store': store,
}
env = dict(os.environ)
env['QVISQVE_CONFIG'] = os.path.join(datadir, 'qvisqve.yaml')