|
|
|
@ -44,7 +44,7 @@ app = typer.Typer()
|
|
|
|
|
CONFIG_FOLDER = os.sep.join([os.environ['HOME'],'.healthcareio'])
|
|
|
|
|
HOST = "https://healthcareio.the-phi.com" if 'PARSER_HOST_URL' not in os.environ else os.environ['PARSER_HOST_URL']
|
|
|
|
|
@app.command(name='init')
|
|
|
|
|
def config(email:str,provider:str='sqlite') :
|
|
|
|
|
def config(email:str,provider:str='sqlite',auth_file:str=None) :
|
|
|
|
|
"""\b
|
|
|
|
|
Generate configuration file needed with default data store. For supported data-store providers visit https://hiplab.mc.vanderbilt.edu/git/hiplab/data-transport.git
|
|
|
|
|
|
|
|
|
@ -58,7 +58,14 @@ def config(email:str,provider:str='sqlite') :
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(CONFIG_FOLDER) :
|
|
|
|
|
os.mkdir(CONFIG_FOLDER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# NOTE:
|
|
|
|
|
# if a provider is setup as an environment variable, we override the parameter
|
|
|
|
|
# This is designed for developement and containers
|
|
|
|
|
#
|
|
|
|
|
if 'X12_DATABASE' in os.environ :
|
|
|
|
|
provider = os.environ['X12_DATABASE']
|
|
|
|
|
if provider in ['sqlite','sqlite3'] :
|
|
|
|
|
_db = os.sep.join([CONFIG_FOLDER,_db+'.db3'])
|
|
|
|
|
|
|
|
|
@ -75,6 +82,11 @@ def config(email:str,provider:str='sqlite') :
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if auth_file and os.path.exists(auth_file) and provider not in ['sqlite','sqlite3'] :
|
|
|
|
|
f = open(auth_file)
|
|
|
|
|
_auth = json.loads(f.read())
|
|
|
|
|
f.close()
|
|
|
|
|
_config['store'] = dict(_config['store'],**_auth)
|
|
|
|
|
#
|
|
|
|
|
# Let create or retrieve a user's key/token to make sure he/she has access to features they need
|
|
|
|
|
# This would also allow us to allow the users to be informed of new versions
|
|
|
|
|