Added custom port and bind address args
parent
b1ef248ee9
commit
ae359de562
21
onionr.sh
21
onionr.sh
|
@ -2,22 +2,5 @@
|
|||
ORIG_ONIONR_RUN_DIR=`pwd`
|
||||
export ORIG_ONIONR_RUN_DIR
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
[[ -n "$USE_TOR" ]] || USE_TOR=1
|
||||
[[ -n "$PORT" ]] || PORT=8080
|
||||
[[ -n "$KEEP_LOG" ]] || KEEP_LOG=0
|
||||
[[ -n "$STORE_PLAINTEXT" ]] || STORE_PLAINTEXT=1
|
||||
|
||||
PRIVKEY_OPT=""
|
||||
[[ -f "privkey.key" ]] && PRIVKEY_OPT="--private-key privkey.key"
|
||||
|
||||
python run-onionr-node.py \
|
||||
--open-ui 0 \
|
||||
--onboarding 0 \
|
||||
--bind-address 0.0.0.0 \
|
||||
--port $PORT \
|
||||
--use-tor $USE_TOR \
|
||||
--keep-log-on-exit $KEEP_LOG \
|
||||
--store-plaintext $STORE_PLAINTEXT \
|
||||
$PRIVKEY_OPT \
|
||||
"$@"
|
||||
cd src
|
||||
./__init__.py "$@"
|
|
@ -55,6 +55,12 @@ def show_info(p: Process):
|
|||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument(
|
||||
"--bind-address", help="Address to bind to. Be very careful with non-loopback",
|
||||
type=str, default="")
|
||||
parser.add_argument(
|
||||
"--port", help="Port to bind to, must be available and possible",
|
||||
type=int, default=0)
|
||||
parser.add_argument(
|
||||
"--use-bootstrap-file", help="Use bootstrap node list file",
|
||||
type=int, default=1)
|
||||
|
@ -129,6 +135,13 @@ config['general']['dev_mode'] = False
|
|||
config['general']['store_plaintext_blocks'] = True
|
||||
config['general']['use_bootstrap_list'] = True
|
||||
config['transports']['tor'] = True
|
||||
config['general']['bind_port'] = 0 # client api server port
|
||||
config['general']['bind_address'] = '' # client api server address
|
||||
|
||||
if args.bind_address:
|
||||
config['general']['bind_address'] = args.bind_address
|
||||
if args.port:
|
||||
config['client']['client']['port'] = args.port
|
||||
|
||||
if not args.use_bootstrap_file:
|
||||
config['general']['use_bootstrap_list'] = False
|
||||
|
|
|
@ -50,11 +50,18 @@ class PrivateAPI:
|
|||
|
||||
self.startTime = epoch.get_epoch()
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
|
||||
bind_port = int(config.get('client.client.port', 59496))
|
||||
self.bindPort = bind_port
|
||||
|
||||
self.clientToken = config.get('client.webpassword')
|
||||
|
||||
if config.get('general.bind_address'):
|
||||
with open(private_API_host_file, 'w') as bindFile:
|
||||
bindFile.write(config.get('general.bind_address'))
|
||||
self.host = config.get('general.bind_address')
|
||||
else:
|
||||
self.host = httpapi.apiutils.setbindip.set_bind_IP(
|
||||
private_API_host_file)
|
||||
logger.info('Running api on %s:%s' % (self.host, self.bindPort))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"general": {
|
||||
"allow_public_api_dns_rebinding": false,
|
||||
"announce_node": true,
|
||||
"bind_address": "",
|
||||
"dev_mode": false,
|
||||
"display_header": true,
|
||||
"ephemeral_tunnels": false,
|
||||
|
|
|
@ -24,6 +24,7 @@ class OnionrConfig(unittest.TestCase):
|
|||
self.assertEqual(conf['allocations']['disk'], 1073741824)
|
||||
self.assertEqual(conf['allocations']['disk'], 1073741824)
|
||||
self.assertEqual(conf['general']['announce_node'], True)
|
||||
self.assertEqual(conf['general']['bind_address'], '')
|
||||
self.assertEqual(conf['general']['dev_mode'], False)
|
||||
self.assertEqual(conf['general']['display_header'], True)
|
||||
self.assertEqual(conf['general']['ephemeral_tunnels'], False)
|
||||
|
|
Loading…
Reference in New Issue