* always check needed config on startup
+ added Dockerfile
This commit is contained in:
parent
307fbf235a
commit
2907471b5f
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM ubuntu:xenial
|
||||||
|
|
||||||
|
#Base settings
|
||||||
|
ENV HOME /root
|
||||||
|
|
||||||
|
#Install needed packages
|
||||||
|
RUN apt update && apt install -y python3 python3-dev python3-pip tor
|
||||||
|
|
||||||
|
#Add Onionr source
|
||||||
|
COPY . /root
|
||||||
|
VOLUME /root/data
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
#Set upstart command
|
||||||
|
#CMD (! ${ENABLE_TOR} || tor&) && python zeronet.py --ui_ip 0.0.0.0 --fileserver_port 26552
|
||||||
|
CMD bash
|
||||||
|
|
||||||
|
#Expose ports
|
||||||
|
EXPOSE 8080
|
@ -135,18 +135,19 @@ class Onionr:
|
|||||||
self.onionrCore.createAddressDB()
|
self.onionrCore.createAddressDB()
|
||||||
|
|
||||||
# Get configuration
|
# Get configuration
|
||||||
|
if type(config.get('client.hmac')) is type(None):
|
||||||
if not data_exists:
|
config.set('client.hmac', base64.b16encode(os.urandom(32)).decode('utf-8'), savefile=True)
|
||||||
# Generate default config
|
if type(config.get('client.port')) is type(None):
|
||||||
# Hostname should only be set if different from 127.x.x.x. Important for DNS rebinding attack prevention.
|
#while True:
|
||||||
if self.debug:
|
randomPort = random.randint(1024, 65535)
|
||||||
randomPort = 8080
|
# if self.onionrUtils.checkPort(randomPort):
|
||||||
else:
|
# break
|
||||||
while True:
|
config.set('client.port', randomPort, savefile=True)
|
||||||
randomPort = random.randint(1024, 65535)
|
if type(config.get('client.participate')) is type(None):
|
||||||
if self.onionrUtils.checkPort(randomPort):
|
config.set('client.participate', True, savefile=True)
|
||||||
break
|
if type(config.get('client.api_version')) is type(None):
|
||||||
config.set('client', {'participate': True, 'hmac': base64.b16encode(os.urandom(32)).decode('utf-8'), 'port': randomPort, 'api_version': API_VERSION}, True)
|
config.set('client.api_version', API_VERSION, savefile=True)
|
||||||
|
|
||||||
|
|
||||||
self.cmds = {
|
self.cmds = {
|
||||||
'': self.showHelpSuggestion,
|
'': self.showHelpSuggestion,
|
||||||
|
Loading…
Reference in New Issue
Block a user