Skip to content

Commit

Permalink
rollback on commands constant usage for type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Sep 14, 2024
1 parent 371ef8f commit 75c9898
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions generators/spring-boot/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import chalk from 'chalk';
import type { JHipsterCommandDefinition } from '../../lib/command/index.js';
import { GENERATOR_JAVA, GENERATOR_LIQUIBASE, GENERATOR_SPRING_DATA_RELATIONAL } from '../generator-list.js';
import { createBase64Secret, createSecret } from '../base/support/secret.js';
import { applicationTypes, authenticationTypes, databaseTypes, serviceDiscoveryTypes } from '../../lib/jhipster/index.js';
import { applicationTypes, authenticationTypes } from '../../lib/jhipster/index.js';

const { OAUTH2, SESSION, JWT } = authenticationTypes;
const { CONSUL, EUREKA, NO: NO_SERVICE_DISCOVERY } = serviceDiscoveryTypes;
const { GATEWAY, MICROSERVICE } = applicationTypes;
const { SQL, NO: NO_DATABASE, MONGODB, COUCHBASE, CASSANDRA, NEO4J } = databaseTypes;

const command = {
options: {
Expand Down Expand Up @@ -75,12 +73,12 @@ const command = {
when: () => ['gateway', 'microservice'].includes(gen.jhipsterConfigWithDefaults.applicationType),
type: 'list',
message: 'Which service discovery server do you want to use?',
default: CONSUL,
default: 'consul',
}),
choices: [
{ value: CONSUL, name: 'Consul (recommended)' },
{ value: EUREKA, name: 'JHipster Registry (legacy, uses Eureka, provides Spring Cloud Config support)' },
{ value: NO_SERVICE_DISCOVERY, name: 'No service discovery' },
{ value: 'consul', name: 'Consul (recommended)' },
{ value: 'eureka', name: 'JHipster Registry (legacy, uses Eureka, provides Spring Cloud Config support)' },
{ value: 'no', name: 'No service discovery' },
],
scope: 'storage',
},
Expand All @@ -100,9 +98,9 @@ const command = {
default: () => gen.jhipsterConfigWithDefaults.authenticationType,
}),
choices: [
{ value: JWT, name: 'JWT authentication (stateless, with a token)' },
{ value: OAUTH2, name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)' },
{ value: SESSION, name: 'HTTP Session Authentication (stateful, default Spring Security mechanism)' },
{ value: 'jwt', name: 'JWT authentication (stateless, with a token)' },
{ value: 'oauth2', name: 'OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)' },
{ value: 'session', name: 'HTTP Session Authentication (stateful, default Spring Security mechanism)' },
],
configure: gen => {
const { jwtSecretKey, rememberMeKey, authenticationType, applicationType } = gen.jhipsterConfigWithDefaults;
Expand Down Expand Up @@ -146,10 +144,10 @@ const command = {
prompt: gen => ({
type: 'confirm',
message: 'Do you want to allow relationships with User entity?',
when: ({ authenticationType }) => (authenticationType ?? gen.jhipsterConfigWithDefaults.authenticationType) === 'oauth2',
when: ({ authenticationType }) => (authenticationType ?? gen.jhipsterConfigWithDefaults.authenticationType) === OAUTH2,
}),
configure: gen => {
if (gen.jhipsterConfig.syncUserWithIdp === undefined && gen.jhipsterConfigWithDefaults.authenticationType === 'oauth2') {
if (gen.jhipsterConfig.syncUserWithIdp === undefined && gen.jhipsterConfigWithDefaults.authenticationType === OAUTH2) {
if (gen.isJhipsterVersionLessThan('8.1.1')) {
gen.jhipsterConfig.syncUserWithIdp = true;
}
Expand Down Expand Up @@ -179,7 +177,7 @@ const command = {
type: String,
hide: true,
},
choices: [SQL, MONGODB, COUCHBASE, CASSANDRA, NEO4J, NO_DATABASE],
choices: ['sql', 'mongodb', 'couchbase', 'cassandra', 'neo4j', 'no'],
scope: 'storage',
},
},
Expand Down

0 comments on commit 75c9898

Please sign in to comment.