Login
The first command should be used to login a user, and store its token in $XDG_CONFIG_HOME/arkindex/cli.yaml
default_host: prod
hosts:
prod:
url: https://arkindex.teklia.com
token: XXXX
dev:
url: https://localhost
token: YYY
The command should ask a few questions:
- url of the arkindex instance
- slug of the instance (prod, dev, ...)
- user email
- user password
And then make a login request on the backend. If the auth is valid, it should then ask if this host is the default host to use later on.
A new Python class named Profiles
must be created in arkindex_cli/auth.py
. It manages Profile
namedtuples (just the slug, url & token)
# parse existing auth profiles in config
profiles = Profiles(path='path/fo/file.yml')
# Returns a Profile or None
profiles.get_default_profile()
# Add a new profile in memory
profiles.add_profile('demo', 'http://demo.teklia.com', 'XXX')
# Save changes in configured path from __init__
profiles.save()
Edited by Bastien Abadie