Skip to content

Commit

Permalink
add mysql health check customization
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Oct 30, 2024
1 parent c8d77ed commit 298143c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions generators/quarkus/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,21 @@ export default class extends BaseApplicationGenerator {

get [BaseApplicationGenerator.POST_WRITING]() {
return this.asPostWritingTaskGroup({
addMysqlSleep({ application }) {
if (application.prodDatabaseTypeMysql) {
this.editFile(`${application.dockerServicesDir}mysql.yml`, content =>
content
.replace(/test: [^\n]*/, "test: ['CMD-SHELL', 'mysql -e \"SHOW DATABASES;\" && sleep 5']")
.replace('timeout: 5s', 'timeout: 10s'),
);
}
},
updatePackageJsonScripts({ application }) {
this.packageJson.merge({
scripts: {
'ci:backend:test': 'npm run backend:info && npm run backend:doc:test && npm run backend:unit:test',
},
});
if (application.prodDatabaseTypeMysql) {
this.packageJson.merge({
scripts: {
'services:db:await': 'sleep 10',
},
});
}
if (application.buildToolGradle) {
this.packageJson.merge({
scripts: {
Expand Down

0 comments on commit 298143c

Please sign in to comment.