Show config via getConfig console command
This commit is contained in:
parent
27a9ea78b8
commit
522e9ebf39
2 changed files with 31 additions and 0 deletions
|
@ -165,6 +165,8 @@ class Config(object):
|
||||||
action.add_argument('message', help='Message to sign')
|
action.add_argument('message', help='Message to sign')
|
||||||
action.add_argument('privatekey', help='Private key')
|
action.add_argument('privatekey', help='Private key')
|
||||||
|
|
||||||
|
action = self.subparsers.add_parser("getConfig", help='Return json-encoded info')
|
||||||
|
|
||||||
# Config parameters
|
# Config parameters
|
||||||
self.parser.add_argument('--verbose', help='More detailed logging', action='store_true')
|
self.parser.add_argument('--verbose', help='More detailed logging', action='store_true')
|
||||||
self.parser.add_argument('--debug', help='Debug mode', action='store_true')
|
self.parser.add_argument('--debug', help='Debug mode', action='store_true')
|
||||||
|
@ -408,4 +410,29 @@ class Config(object):
|
||||||
|
|
||||||
open(self.config_file, "w").write("\n".join(lines))
|
open(self.config_file, "w").write("\n".join(lines))
|
||||||
|
|
||||||
|
def getServerInfo(self):
|
||||||
|
from Plugin import PluginManager
|
||||||
|
|
||||||
|
info = {
|
||||||
|
"platform": sys.platform,
|
||||||
|
"fileserver_ip": self.fileserver_ip,
|
||||||
|
"fileserver_port": self.fileserver_port,
|
||||||
|
"ui_ip": self.ui_ip,
|
||||||
|
"ui_port": self.ui_port,
|
||||||
|
"version": self.version,
|
||||||
|
"rev": self.rev,
|
||||||
|
"language": self.language,
|
||||||
|
"debug": self.debug,
|
||||||
|
"plugins": PluginManager.plugin_manager.plugin_names
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
info["ip_external"] = sys.modules["main"].file_server.port_opened
|
||||||
|
info["tor_enabled"] = sys.modules["main"].file_server.tor_manager.enabled
|
||||||
|
info["tor_status"] = sys.modules["main"].file_server.tor_manager.status
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
config = Config(sys.argv)
|
config = Config(sys.argv)
|
||||||
|
|
|
@ -481,6 +481,10 @@ class Actions(object):
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
print "Unknown response (%s): %s" % (err, res)
|
print "Unknown response (%s): %s" % (err, res)
|
||||||
|
|
||||||
|
def getConfig(self):
|
||||||
|
import json
|
||||||
|
print json.dumps(config.getServerInfo(), indent=2, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
actions = Actions()
|
actions = Actions()
|
||||||
# Starts here when running zeronet.py
|
# Starts here when running zeronet.py
|
||||||
|
|
Loading…
Reference in a new issue