config(cb) {
            try {
                appConfig.nethash = Buffer.from(genesisblock.payloadHash, 'hex').toString('hex');
            } catch (e) {
                logger.error('Failed to assign nethash from genesis block');
                throw Error(e);
            }

            if (appConfig.dapp.masterrequired && !appConfig.dapp.masterpassword) {
                const randomstring = require('randomstring');

                appConfig.dapp.masterpassword = randomstring.generate({
                    length: 12,
                    readable: true,
                    charset: 'alphanumeric'
                });

                if (appConfig.loading.snapshot != null) {
                    delete appConfig.loading.snapshot;
                }
            }
            fs.writeFileSync('./config.json', JSON.stringify(appConfig, null, 4));
            cb(null, appConfig);
        }
/**
         * Loads `payloadHash` and generate dapp password if it is empty and required.
         * Then updates config.json with new random  password.
         * @method config
         * @param {nodeStyleCallback} cb - Callback function with the mutated `appConfig`.
         * @throws {Error} If failed to assign nethash from genesis block.
         */
Loads `payloadHash` and generate dapp password if it is empty and required.
Then updates config.json with new random  password.
@method config
@param {nodeStyleCallback} cb - Callback function with the mutated `appConfig`.
@throws {Error} If failed to assign nethash from genesis block.
Loads ` payloadHash ` and generate dapp password if it is empty and required . Then updates config . json with new random password . @method config @param { nodeStyleCallback } cb - Callback function with the mutated ` appConfig ` . @throws { Error } If failed to assign nethash from genesis block .
config(cb) {
            try {
                appConfig.nethash = Buffer.from(genesisblock.payloadHash, 'hex').toString('hex');
            } catch (e) {
                logger.error('Failed to assign nethash from genesis block');
                throw Error(e);
            }
            if (appConfig.dapp.masterrequired && !appConfig.dapp.masterpassword) {
                const randomstring = require('randomstring');
                appConfig.dapp.masterpassword = randomstring.generate({
                    length: 12,
                    readable: true,
                    charset: 'alphanumeric'
                });
                if (appConfig.loading.snapshot != null) {
                    delete appConfig.loading.snapshot;
                }
            }
            fs.writeFileSync('./config.json', JSON.stringify(appConfig, null, 4));
            cb(null, appConfig);
        }
config ( cb ) { try { appConfig . nethash = Buffer . from ( genesisblock . payloadHash , 'hex' ) . toString ( 'hex' ) ; } catch ( e ) { logger . error ( 'Failed to assign nethash from genesis block' ) ; throw Error ( e ) ; } if ( appConfig . dapp . masterrequired && ! appConfig . dapp . masterpassword ) { const randomstring = require ( 'randomstring' ) ; appConfig . dapp . masterpassword = randomstring . generate ( { length : 12 , readable : true , charset : 'alphanumeric' } ) ; if ( appConfig . loading . snapshot != null ) { delete appConfig . loading . snapshot ; } } fs . writeFileSync ( './config.json' , JSON . stringify ( appConfig , null , 4 ) ) ; cb ( null , appConfig ) ; }
Loads `payloadHash` and generate dapp password if it is empty and required.
Loads ` payloadHash ` and generate dapp password if it is empty and required .