def setup(self, config_file):
        """ Setup settings from a JSON config file """

        def get_config_and_warn(key, default, abort=False):
            value = config.get(key, None)
            if not value:
                print(f"Cannot find {key} in settings, using default value: {default}")
                value = default
                if abort:
                    sys.exit(-1)
            return value

        if not self.DATA_DIR_PATH:
            # Setup default data dir
            self.set_data_dir(None)

        with open(config_file) as data_file:
            data = json.load(data_file)

        config = data['ProtocolConfiguration']
        self.MAGIC = config['Magic']
        self.ADDRESS_VERSION = config['AddressVersion']
        self.STANDBY_VALIDATORS = config['StandbyValidators']
        self.SEED_LIST = config['SeedList']
        self.RPC_LIST = config['RPCList']

        fees = config['SystemFee']
        self.ALL_FEES = fees
        self.ENROLLMENT_TX_FEE = fees['EnrollmentTransaction']
        self.ISSUE_TX_FEE = fees['IssueTransaction']
        self.PUBLISH_TX_FEE = fees['PublishTransaction']
        self.REGISTER_TX_FEE = fees['RegisterTransaction']

        config = data['ApplicationConfiguration']
        self.LEVELDB_PATH = config['DataDirectoryPath']
        self.RPC_PORT = int(config['RPCPort'])
        self.NODE_PORT = int(config['NodePort'])
        self.WS_PORT = config['WsPort']
        self.URI_PREFIX = config['UriPrefix']
        self.ACCEPT_INCOMING_PEERS = config.get('AcceptIncomingPeers', False)

        self.BOOTSTRAP_NAME = get_config_and_warn('BootstrapName', "mainnet")
        self.BOOTSTRAP_LOCATIONS = get_config_and_warn('BootstrapFiles', "abort", abort=True)
        Helper.ADDRESS_VERSION = self.ADDRESS_VERSION

        self.USE_DEBUG_STORAGE = config.get('DebugStorage', False)
        self.DEBUG_STORAGE_PATH = config.get('DebugStoragePath', 'Chains/debugstorage')
        self.NOTIFICATION_DB_PATH = config.get('NotificationDataPath', 'Chains/notification_data')
        self.SERVICE_ENABLED = config.get('ServiceEnabled', self.ACCEPT_INCOMING_PEERS)
        self.COMPILER_NEP_8 = config.get('CompilerNep8', False)
        self.REST_SERVER = config.get('RestServer', self.DEFAULT_REST_SERVER)
        self.RPC_SERVER = config.get('RPCServer', self.DEFAULT_RPC_SERVER)
Setup settings from a JSON config file