Skip to content

Commit

Permalink
add config file option
Browse files Browse the repository at this point in the history
  • Loading branch information
Horace Ip authored and Horace Ip committed Oct 4, 2019
1 parent 7a5e9c7 commit 488d227
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web/bin/nanocube_webconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def main():
argparser.add_argument('-p','--port',type=int,required=False,
const=8000,nargs='?')

argparser.add_argument('-c','--config',type=str,required=False,
default='',nargs='?')

#default path if installed
webdir = os.path.dirname(os.path.realpath(__file__))
webdir += '/../share/nanocube/web'
Expand Down Expand Up @@ -173,6 +176,11 @@ def main():
for t in ts:
config['widget'][t] = ts[t]


# read supplied config file
if(args.config != ''):
config=json.load(open(args.config))

if args.port is None:
print(json.dumps(config,indent=2))
else:
Expand All @@ -181,7 +189,7 @@ def main():
shutil.copytree(args.web,
tmpdir+'/web')
os.chdir(tmpdir+'/web')

f = open('config.json','w')
f.write(json.dumps(config))
f.close()
Expand Down

0 comments on commit 488d227

Please sign in to comment.