function askForServiceDiscovery() {
    if (this.regenerate) return;

    const done = this.async();

    const serviceDiscoveryEnabledApps = [];
    this.appConfigs.forEach((appConfig, index) => {
        if (appConfig.serviceDiscoveryType) {
            serviceDiscoveryEnabledApps.push({
                baseName: appConfig.baseName,
                serviceDiscoveryType: appConfig.serviceDiscoveryType
            });
        }
    });

    if (serviceDiscoveryEnabledApps.length === 0) {
        this.serviceDiscoveryType = false;
        done();
        return;
    }

    if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'consul')) {
        this.serviceDiscoveryType = 'consul';
        this.log(chalk.green('Consul detected as the service discovery and configuration provider used by your apps'));
        done();
    } else if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'eureka')) {
        this.serviceDiscoveryType = 'eureka';
        this.log(chalk.green('JHipster registry detected as the service discovery and configuration provider used by your apps'));
        done();
    } else {
        this.log(chalk.yellow('Unable to determine the service discovery and configuration provider to use from your apps configuration.'));
        this.log('Your service discovery enabled apps:');
        serviceDiscoveryEnabledApps.forEach(app => {
            this.log(` -${app.baseName} (${app.serviceDiscoveryType})`);
        });

        const prompts = [
            {
                type: 'list',
                name: 'serviceDiscoveryType',
                message: 'Which Service Discovery registry and Configuration server would you like to use ?',
                choices: [
                    {
                        value: 'eureka',
                        name: 'JHipster Registry'
                    },
                    {
                        value: 'consul',
                        name: 'Consul'
                    },
                    {
                        value: false,
                        name: 'No Service Discovery and Configuration'
                    }
                ],
                default: 'eureka'
            }
        ];

        this.prompt(prompts).then(props => {
            this.serviceDiscoveryType = props.serviceDiscoveryType;
            done();
        });
    }
}
function askForServiceDiscovery() {
    if (this.regenerate) return;

    const done = this.async();

    const serviceDiscoveryEnabledApps = [];
    this.appConfigs.forEach((appConfig, index) => {
        if (appConfig.serviceDiscoveryType) {
            serviceDiscoveryEnabledApps.push({
                baseName: appConfig.baseName,
                serviceDiscoveryType: appConfig.serviceDiscoveryType
            });
        }
    });

    if (serviceDiscoveryEnabledApps.length === 0) {
        this.serviceDiscoveryType = false;
        done();
        return;
    }

    if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'consul')) {
        this.serviceDiscoveryType = 'consul';
        this.log(chalk.green('Consul detected as the service discovery and configuration provider used by your apps'));
        done();
    } else if (serviceDiscoveryEnabledApps.every(app => app.serviceDiscoveryType === 'eureka')) {
        this.serviceDiscoveryType = 'eureka';
        this.log(chalk.green('JHipster registry detected as the service discovery and configuration provider used by your apps'));
        done();
    } else {
        this.log(chalk.yellow('Unable to determine the service discovery and configuration provider to use from your apps configuration.'));
        this.log('Your service discovery enabled apps:');
        serviceDiscoveryEnabledApps.forEach(app => {
            this.log(` -${app.baseName} (${app.serviceDiscoveryType})`);
        });

        const prompts = [
            {
                type: 'list',
                name: 'serviceDiscoveryType',
                message: 'Which Service Discovery registry and Configuration server would you like to use ?',
                choices: [
                    {
                        value: 'eureka',
                        name: 'JHipster Registry'
                    },
                    {
                        value: 'consul',
                        name: 'Consul'
                    },
                    {
                        value: false,
                        name: 'No Service Discovery and Configuration'
                    }
                ],
                default: 'eureka'
            }
        ];

        this.prompt(prompts).then(props => {
            this.serviceDiscoveryType = props.serviceDiscoveryType;
            done();
        });
    }
}
function askForServiceDiscovery ( ) { if ( this . regenerate ) return ; const done = this . async ( ) ; const serviceDiscoveryEnabledApps = [ ] ; this . appConfigs . forEach ( ( appConfig , index ) => { if ( appConfig . serviceDiscoveryType ) { serviceDiscoveryEnabledApps . push ( { baseName : appConfig . baseName , serviceDiscoveryType : appConfig . serviceDiscoveryType } ) ; } } ) ; if ( serviceDiscoveryEnabledApps . length === 0 ) { this . serviceDiscoveryType = false ; done ( ) ; return ; } if ( serviceDiscoveryEnabledApps . every ( app => app . serviceDiscoveryType === 'consul' ) ) { this . serviceDiscoveryType = 'consul' ; this . log ( chalk . green ( 'Consul detected as the service discovery and configuration provider used by your apps' ) ) ; done ( ) ; } else if ( serviceDiscoveryEnabledApps . every ( app => app . serviceDiscoveryType === 'eureka' ) ) { this . serviceDiscoveryType = 'eureka' ; this . log ( chalk . green ( 'JHipster registry detected as the service discovery and configuration provider used by your apps' ) ) ; done ( ) ; } else { this . log ( chalk . yellow ( 'Unable to determine the service discovery and configuration provider to use from your apps configuration.' ) ) ; this . log ( 'Your service discovery enabled apps:' ) ; serviceDiscoveryEnabledApps . forEach ( app => { this . log ( ` ${ app . baseName } ${ app . serviceDiscoveryType } ` ) ; } ) ; const prompts = [ { type : 'list' , name : 'serviceDiscoveryType' , message : 'Which Service Discovery registry and Configuration server would you like to use ?' , choices : [ { value : 'eureka' , name : 'JHipster Registry' } , { value : 'consul' , name : 'Consul' } , { value : false , name : 'No Service Discovery and Configuration' } ] , default : 'eureka' } ] ; this . prompt ( prompts ) . then ( props => { this . serviceDiscoveryType = props . serviceDiscoveryType ; done ( ) ; } ) ; } }
Ask For Service Discovery
Ask For Service Discovery
Ask For Service Discovery