2020-04-03 09:02:36 +00:00
|
|
|
"""Onionr - Private P2P Communication.
|
2019-06-16 06:06:32 +00:00
|
|
|
|
2020-04-03 09:02:36 +00:00
|
|
|
Initialize Onionr configuration
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import base64
|
|
|
|
|
|
|
|
import ujson as json
|
|
|
|
|
|
|
|
import config
|
2022-09-27 17:21:00 +00:00
|
|
|
from logger import log as logging
|
2022-02-07 01:18:53 +00:00
|
|
|
import onionrvalues
|
2020-04-03 09:02:36 +00:00
|
|
|
from utils import readstatic
|
|
|
|
"""
|
2022-03-18 00:56:31 +00:00
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-04-03 09:02:36 +00:00
|
|
|
"""
|
|
|
|
|
2019-03-09 01:57:44 +00:00
|
|
|
|
2019-09-08 09:48:16 +00:00
|
|
|
def setup_config():
|
2019-05-15 23:25:36 +00:00
|
|
|
if not os.path.exists(config._configfile):
|
2019-09-11 02:59:33 +00:00
|
|
|
# this is the default config, it will be overwritten if a config file already exists. Else, it saves it
|
|
|
|
conf_data = readstatic.read_static('default_config.json', ret_bin=False)
|
|
|
|
config.set_config(json.loads(conf_data))
|
2019-03-09 01:57:44 +00:00
|
|
|
|
|
|
|
config.save()
|
|
|
|
|
2019-09-11 02:53:28 +00:00
|
|
|
config.reload()
|