Skip to content

Commit

Permalink
load configuration at very start
Browse files Browse the repository at this point in the history
  • Loading branch information
peerchemist committed Feb 26, 2017
1 parent cce61f4 commit c711c88
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pacli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
class Settings:
pass

def load_conf():
'''load user configuration'''

user_config = read_conf(conf_file)
for key in user_config:
setattr(Settings, key, user_config[key])

def first_run():
'''if first run, setup local configuration directory.'''

Expand All @@ -25,10 +32,6 @@ def set_up(provider):
'''setup'''

first_run() # check if this is first run first
# load config
user_config = read_conf(conf_file)
for key in user_config:
setattr(Settings, key, user_config[key])

# check if provider is working as expected
assert provider.getinfo()["connections"] > 0, {"error": "Not connected to network."}
Expand Down Expand Up @@ -390,7 +393,8 @@ def cli():

def main():

provider = pa.RpcNode(testnet=True)
load_conf()
provider = pa.RpcNode(testnet=Settings.testnet)
set_up(provider)
args = cli()

Expand Down

0 comments on commit c711c88

Please sign in to comment.