generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
36 lines (35 loc) • 1.84 kB
JavaScript
import { applicationTypes, authenticationTypes, monitoringTypes } from '../../lib/jhipster/index.js';
const { PROMETHEUS } = monitoringTypes;
const { MICROSERVICE } = applicationTypes;
const { OAUTH2 } = authenticationTypes;
export function writeFiles() {
return {
cleanup() {
if (this.isJhipsterVersionLessThan('7.10.0')) {
this.removeFile('realm-config/jhipster-users-0.json');
}
},
writeDockerCompose({ deployment }) {
this.writeFile('docker-compose.yml.ejs', 'docker-compose.yml', deployment);
this.writeFile('README-DOCKER-COMPOSE.md.ejs', 'README-DOCKER-COMPOSE.md', deployment);
},
writeRegistryFiles({ deployment }) {
if (deployment.serviceDiscoveryAny) {
this.writeFile('central-server-config/application.yml.ejs', 'central-server-config/application.yml', deployment);
}
},
writeKeycloakFiles({ deployment }) {
if (deployment.authenticationType === OAUTH2 && deployment.applicationType !== MICROSERVICE) {
this.writeFile('realm-config/keycloak-health-check.sh', 'realm-config/keycloak-health-check.sh', deployment);
this.writeFile('realm-config/jhipster-realm.json.ejs', 'realm-config/jhipster-realm.json', deployment);
}
},
writePrometheusFiles({ deployment }) {
if (deployment.monitoring !== PROMETHEUS)
return;
this.writeFile('prometheus-conf/prometheus.yml.ejs', 'prometheus-conf/prometheus.yml', deployment);
this.writeFile('prometheus-conf/alert_rules.yml.ejs', 'prometheus-conf/alert_rules.yml', deployment);
this.writeFile('alertmanager-conf/config.yml.ejs', 'alertmanager-conf/config.yml', deployment);
},
};
}