read config file name from command line
This commit is contained in:
@@ -5,6 +5,7 @@ import requests
|
||||
import tomlkit
|
||||
import urllib3
|
||||
import datetime
|
||||
import sys
|
||||
urllib3.disable_warnings()
|
||||
|
||||
class StatusPage:
|
||||
@@ -115,7 +116,10 @@ class StatusPage:
|
||||
'username': 'root',
|
||||
'password': 'foobar'
|
||||
}
|
||||
self.config.update(tomlkit.loads(open('config.toml').read()))
|
||||
config_file = "config.toml"
|
||||
if len(sys.argv) > 1:
|
||||
config_file = sys.argv[1]
|
||||
self.config.update(tomlkit.loads(open(config_file).read()))
|
||||
|
||||
if __name__ == "__main__":
|
||||
page = StatusPage()
|
||||
|
||||
Reference in New Issue
Block a user