@mshima/generator-jhipster-nodejs 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/LICENSE.txt +204 -0
  2. package/README.md +243 -2
  3. package/build-info.json +3 -0
  4. package/cli/cli-customizations.cjs +9 -0
  5. package/cli/cli.cjs +40 -0
  6. package/cli/logo.js +31 -0
  7. package/cli/version.cjs +12 -0
  8. package/generators/ci-cd/USAGE +5 -0
  9. package/generators/ci-cd/command.js +5 -0
  10. package/generators/ci-cd/generator.js +158 -0
  11. package/generators/ci-cd/index.js +2 -0
  12. package/generators/ci-cd/templates/.gitlab-ci.yml.ejs +137 -0
  13. package/generators/ci-cd/templates/azure-pipelines.yml.ejs +68 -0
  14. package/generators/ci-cd/templates/circle.yml.ejs +59 -0
  15. package/generators/ci-cd/templates/docker-registry.yml.ejs +58 -0
  16. package/generators/ci-cd/templates/github-ci.yml.ejs +90 -0
  17. package/generators/ci-cd/templates/jenkins/Jenkinsfile.ejs +104 -0
  18. package/generators/ci-cd/templates/jenkins/idea.gdsl +90 -0
  19. package/generators/ci-cd/templates/jenkins/jenkins.yml.ejs +33 -0
  20. package/generators/ci-cd/templates/travis.yml.ejs +75 -0
  21. package/generators/client/command.js +5 -0
  22. package/generators/client/generator.js +21 -0
  23. package/generators/client/generators/bootstrap/command.js +5 -0
  24. package/generators/client/generators/bootstrap/generator.js +28 -0
  25. package/generators/client/generators/bootstrap/index.js +2 -0
  26. package/generators/client/index.js +2 -0
  27. package/generators/common/generators/bootstrap/command.js +5 -0
  28. package/generators/common/generators/bootstrap/generator.js +37 -0
  29. package/generators/common/generators/bootstrap/index.js +2 -0
  30. package/generators/docker/command.js +5 -0
  31. package/generators/docker/generator.js +16 -0
  32. package/generators/docker/generators/bootstrap/command.js +5 -0
  33. package/generators/docker/generators/bootstrap/generator.js +56 -0
  34. package/generators/docker/generators/bootstrap/index.js +2 -0
  35. package/generators/docker/index.js +2 -0
  36. package/generators/docker/templates/docker/app.yml.ejs +25 -0
  37. package/generators/generator-nodejs-constants.js +32 -0
  38. package/generators/languages/command.js +5 -0
  39. package/generators/languages/generator.js +22 -0
  40. package/generators/languages/index.js +2 -0
  41. package/generators/languages/templates/src/main/webapp/i18n/en/home.json +19 -0
  42. package/generators/languages/templates/src/main/webapp/i18n/es/home.json +19 -0
  43. package/generators/languages/templates/src/main/webapp/i18n/it/home.json +19 -0
  44. package/generators/node-server/command.js +96 -0
  45. package/generators/node-server/entity-files.js +41 -0
  46. package/generators/node-server/files.js +254 -0
  47. package/generators/node-server/generator.js +702 -0
  48. package/generators/node-server/generators/bootstrap/command.js +5 -0
  49. package/generators/node-server/generators/bootstrap/generator.js +83 -0
  50. package/generators/node-server/generators/bootstrap/index.js +2 -0
  51. package/generators/node-server/index.js +2 -0
  52. package/generators/node-server/resources/package.json +76 -0
  53. package/generators/node-server/support/api-fake-data.js +54 -0
  54. package/generators/node-server/support/columns.js +73 -0
  55. package/generators/node-server/support/database.js +24 -0
  56. package/generators/node-server/support/entity-authorities.js +32 -0
  57. package/generators/node-server/support/entity-paths.js +13 -0
  58. package/generators/node-server/support/enums.js +11 -0
  59. package/generators/node-server/support/index.js +9 -0
  60. package/generators/node-server/support/mail-templates.js +82 -0
  61. package/generators/node-server/support/migrations.js +197 -0
  62. package/generators/node-server/support/validators.js +25 -0
  63. package/generators/node-server/templates/.dockerignore.ejs +16 -0
  64. package/generators/node-server/templates/.gitignore.jhi.nodejs.ejs +24 -0
  65. package/generators/node-server/templates/Dockerfile.ejs +54 -0
  66. package/generators/node-server/templates/README.md.jhi.nodejs.ejs +220 -0
  67. package/generators/node-server/templates/package.json.ejs +84 -0
  68. package/generators/node-server/templates/server/README.md.ejs +269 -0
  69. package/generators/node-server/templates/server/e2e/_entityFileName_.database.e2e-spec.ts.ejs +192 -0
  70. package/generators/node-server/templates/server/e2e/_entityFileName_.e2e-spec.ts.ejs +402 -0
  71. package/generators/node-server/templates/server/e2e/account.e2e-spec.ts.ejs +349 -0
  72. package/generators/node-server/templates/server/e2e/app.e2e-spec.ts.ejs +188 -0
  73. package/generators/node-server/templates/server/e2e/authority.e2e-spec.ts.ejs +50 -0
  74. package/generators/node-server/templates/server/e2e/cors.e2e-spec.ts.ejs +110 -0
  75. package/generators/node-server/templates/server/e2e/management.e2e-spec.ts.ejs +180 -0
  76. package/generators/node-server/templates/server/e2e/oauth2-bearer.e2e-spec.ts.ejs +71 -0
  77. package/generators/node-server/templates/server/e2e/session.e2e-spec.ts.ejs +219 -0
  78. package/generators/node-server/templates/server/e2e/setup.test.js.ejs +1 -0
  79. package/generators/node-server/templates/server/e2e/user.e2e-spec.ts.ejs +318 -0
  80. package/generators/node-server/templates/server/env.ejs +1 -0
  81. package/generators/node-server/templates/server/eslint.config.mjs.ejs +48 -0
  82. package/generators/node-server/templates/server/nest-cli.json.ejs +11 -0
  83. package/generators/node-server/templates/server/ormconfig.ts.ejs +35 -0
  84. package/generators/node-server/templates/server/package.json.ejs +143 -0
  85. package/generators/node-server/templates/server/sonar-project.properties.ejs +10 -0
  86. package/generators/node-server/templates/server/src/app.config.spec.ts.ejs +13 -0
  87. package/generators/node-server/templates/server/src/app.config.ts.ejs +179 -0
  88. package/generators/node-server/templates/server/src/app.module.ts.ejs +80 -0
  89. package/generators/node-server/templates/server/src/application-config.ts.ejs +153 -0
  90. package/generators/node-server/templates/server/src/auth/account.controller.ts.ejs +183 -0
  91. package/generators/node-server/templates/server/src/auth/auth.module.ts.ejs +104 -0
  92. package/generators/node-server/templates/server/src/auth/auth.service.ts.ejs +294 -0
  93. package/generators/node-server/templates/server/src/auth/csrf.middleware.spec.ts.ejs +65 -0
  94. package/generators/node-server/templates/server/src/auth/csrf.middleware.ts.ejs +76 -0
  95. package/generators/node-server/templates/server/src/auth/decorators/auth-user.decorator.ts.ejs +8 -0
  96. package/generators/node-server/templates/server/src/auth/decorators/roles.decorator.ts.ejs +4 -0
  97. package/generators/node-server/templates/server/src/auth/dto/key-and-password.dto.ts.ejs +17 -0
  98. package/generators/node-server/templates/server/src/auth/dto/password-change.dto.ts.ejs +17 -0
  99. package/generators/node-server/templates/server/src/auth/dto/user-login.dto.ts.ejs +21 -0
  100. package/generators/node-server/templates/server/src/auth/guards/auth.guard.ts.ejs +50 -0
  101. package/generators/node-server/templates/server/src/auth/guards/oauth2-login.guard.ts.ejs +6 -0
  102. package/generators/node-server/templates/server/src/auth/guards/roles.guard.ts.ejs +25 -0
  103. package/generators/node-server/templates/server/src/auth/index.ts.ejs +8 -0
  104. package/generators/node-server/templates/server/src/auth/jwt.config.spec.ts.ejs +22 -0
  105. package/generators/node-server/templates/server/src/auth/jwt.config.ts.ejs +29 -0
  106. package/generators/node-server/templates/server/src/auth/oauth2.authorities.spec.ts.ejs +24 -0
  107. package/generators/node-server/templates/server/src/auth/oauth2.authorities.ts.ejs +33 -0
  108. package/generators/node-server/templates/server/src/auth/oauth2.config.ts.ejs +51 -0
  109. package/generators/node-server/templates/server/src/auth/passport.jwt.strategy.ts.ejs +45 -0
  110. package/generators/node-server/templates/server/src/auth/passport.oauth2-bearer.strategy.ts.ejs +32 -0
  111. package/generators/node-server/templates/server/src/auth/passport.oauth2.strategy.spec.ts.ejs +27 -0
  112. package/generators/node-server/templates/server/src/auth/passport.oauth2.strategy.ts.ejs +44 -0
  113. package/generators/node-server/templates/server/src/auth/password-util.ts.ejs +10 -0
  114. package/generators/node-server/templates/server/src/auth/password.service.ts.ejs +34 -0
  115. package/generators/node-server/templates/server/src/auth/payload.interface.ts.ejs +14 -0
  116. package/generators/node-server/templates/server/src/auth/role-type.ts.ejs +7 -0
  117. package/generators/node-server/templates/server/src/auth/session-user.middleware.ts.ejs +33 -0
  118. package/generators/node-server/templates/server/src/auth/session.entity.ts.ejs +36 -0
  119. package/generators/node-server/templates/server/src/auth/session.store.spec.ts.ejs +99 -0
  120. package/generators/node-server/templates/server/src/auth/session.store.ts.ejs +116 -0
  121. package/generators/node-server/templates/server/src/auth/user.jwt.controller.ts.ejs +26 -0
  122. package/generators/node-server/templates/server/src/auth/user.oauth2.controller.ts.ejs +78 -0
  123. package/generators/node-server/templates/server/src/auth/user.session.controller.ts.ejs +103 -0
  124. package/generators/node-server/templates/server/src/common/common.module.ts.ejs +19 -0
  125. package/generators/node-server/templates/server/src/common/database/base.entity.ts.ejs +13 -0
  126. package/generators/node-server/templates/server/src/common/database/column-transformers.spec.ts.ejs +46 -0
  127. package/generators/node-server/templates/server/src/common/database/column-transformers.ts.ejs +69 -0
  128. package/generators/node-server/templates/server/src/common/database/column-types.spec.ts.ejs +21 -0
  129. package/generators/node-server/templates/server/src/common/database/column-types.ts.ejs +29 -0
  130. package/generators/node-server/templates/server/src/common/database/pagination.entity.spec.ts.ejs +66 -0
  131. package/generators/node-server/templates/server/src/common/database/pagination.entity.ts.ejs +108 -0
  132. package/generators/node-server/templates/server/src/common/dto/base.dto.ts.ejs +19 -0
  133. package/generators/node-server/templates/server/src/common/errors/error-constants.ts.ejs +10 -0
  134. package/generators/node-server/templates/server/src/common/errors/problem-details.filter.ts.ejs +63 -0
  135. package/generators/node-server/templates/server/src/common/errors/problem.exception.ts.ejs +92 -0
  136. package/generators/node-server/templates/server/src/common/field_validators.ejs +77 -0
  137. package/generators/node-server/templates/server/src/common/header-util.ts.ejs +105 -0
  138. package/generators/node-server/templates/server/src/common/interceptors/logging.interceptor.spec.ts.ejs +93 -0
  139. package/generators/node-server/templates/server/src/common/interceptors/logging.interceptor.ts.ejs +48 -0
  140. package/generators/node-server/templates/server/src/common/logging.spec.ts.ejs +83 -0
  141. package/generators/node-server/templates/server/src/common/logging.ts.ejs +129 -0
  142. package/generators/node-server/templates/server/src/common/metrics.spec.ts.ejs +43 -0
  143. package/generators/node-server/templates/server/src/common/metrics.ts.ejs +198 -0
  144. package/generators/node-server/templates/server/src/common/request.ts.ejs +8 -0
  145. package/generators/node-server/templates/server/src/common/sortable-properties.ts.ejs +43 -0
  146. package/generators/node-server/templates/server/src/common/updatable-properties.ts.ejs +14 -0
  147. package/generators/node-server/templates/server/src/config/application-dev.yml.ejs +118 -0
  148. package/generators/node-server/templates/server/src/config/application-prod.yml.ejs +97 -0
  149. package/generators/node-server/templates/server/src/config/application-secret-samples.yml.ejs +42 -0
  150. package/generators/node-server/templates/server/src/config/application-test.yml.ejs +68 -0
  151. package/generators/node-server/templates/server/src/config/application-tls-samples.yml.ejs +15 -0
  152. package/generators/node-server/templates/server/src/config/application-tls.yml.ejs +15 -0
  153. package/generators/node-server/templates/server/src/config/application.yml.ejs +149 -0
  154. package/generators/node-server/templates/server/src/config.spec.ts.ejs +81 -0
  155. package/generators/node-server/templates/server/src/config.ts.ejs +255 -0
  156. package/generators/node-server/templates/server/src/entities/_entityFileName_/_entityFileName_.controller.ts.ejs +178 -0
  157. package/generators/node-server/templates/server/src/entities/_entityFileName_/_entityFileName_.entity.ts.ejs +110 -0
  158. package/generators/node-server/templates/server/src/entities/_entityFileName_/_entityFileName_.mapper.ts.ejs +37 -0
  159. package/generators/node-server/templates/server/src/entities/_entityFileName_/_entityFileName_.module.ts.ejs +14 -0
  160. package/generators/node-server/templates/server/src/entities/_entityFileName_/_entityFileName_.service.ts.ejs +123 -0
  161. package/generators/node-server/templates/server/src/entities/_entityFileName_/dto/_entityFileName_.dto.ts.ejs +99 -0
  162. package/generators/node-server/templates/server/src/mail/mail.module.ts.ejs +49 -0
  163. package/generators/node-server/templates/server/src/mail/mail.service.spec.ts.ejs +105 -0
  164. package/generators/node-server/templates/server/src/mail/mail.service.ts.ejs +120 -0
  165. package/generators/node-server/templates/server/src/main.ts.ejs +114 -0
  166. package/generators/node-server/templates/server/src/management/api-docs.controller.ts.ejs +27 -0
  167. package/generators/node-server/templates/server/src/management/api-docs.service.ts.ejs +8 -0
  168. package/generators/node-server/templates/server/src/management/configuration.controller.ts.ejs +80 -0
  169. package/generators/node-server/templates/server/src/management/health.controller.spec.ts.ejs +79 -0
  170. package/generators/node-server/templates/server/src/management/health.controller.ts.ejs +87 -0
  171. package/generators/node-server/templates/server/src/management/health.module.ts.ejs +9 -0
  172. package/generators/node-server/templates/server/src/management/loggers.controller.ts.ejs +40 -0
  173. package/generators/node-server/templates/server/src/management/management.controller.spec.ts.ejs +26 -0
  174. package/generators/node-server/templates/server/src/management/management.controller.ts.ejs +34 -0
  175. package/generators/node-server/templates/server/src/management/management.module.ts.ejs +21 -0
  176. package/generators/node-server/templates/server/src/management/metrics.controller.ts.ejs +85 -0
  177. package/generators/node-server/templates/server/src/migrations/1570200270081-CreateTables.ts.ejs +64 -0
  178. package/generators/node-server/templates/server/src/migrations/1570200270082-CreateSessions.ts.ejs +26 -0
  179. package/generators/node-server/templates/server/src/migrations/1570200490072-SeedUsersRoles.ts.ejs +74 -0
  180. package/generators/node-server/templates/server/src/migrations/_entityConstraintsMigration_.ts.ejs +40 -0
  181. package/generators/node-server/templates/server/src/migrations/_entityMigration_.ts.ejs +26 -0
  182. package/generators/node-server/templates/server/src/migrations/support/schema.ts.ejs +202 -0
  183. package/generators/node-server/templates/server/src/orm.config.ts.ejs +147 -0
  184. package/generators/node-server/templates/server/src/registry/consul.service.ts.ejs +70 -0
  185. package/generators/node-server/templates/server/src/registry/eureka.service.ts.ejs +129 -0
  186. package/generators/node-server/templates/server/src/swagger.ts.ejs +24 -0
  187. package/generators/node-server/templates/server/src/tls.ts.ejs +27 -0
  188. package/generators/node-server/templates/server/src/users/authority.controller.ts.ejs +85 -0
  189. package/generators/node-server/templates/server/src/users/authority.entity.ts.ejs +22 -0
  190. package/generators/node-server/templates/server/src/users/dto/authority.dto.ts.ejs +10 -0
  191. package/generators/node-server/templates/server/src/users/dto/user.dto.ts.ejs +116 -0
  192. package/generators/node-server/templates/server/src/users/public.user.controller.ts.ejs +51 -0
  193. package/generators/node-server/templates/server/src/users/user.controller.ts.ejs +191 -0
  194. package/generators/node-server/templates/server/src/users/user.entity.ts.ejs +63 -0
  195. package/generators/node-server/templates/server/src/users/user.mapper.ts.ejs +26 -0
  196. package/generators/node-server/templates/server/src/users/user.module.ts.ejs +19 -0
  197. package/generators/node-server/templates/server/src/users/user.service.ts.ejs +156 -0
  198. package/generators/node-server/templates/server/tsconfig.build.json.ejs +9 -0
  199. package/generators/node-server/templates/server/tsconfig.json.ejs +23 -0
  200. package/generators/node-server/templates/server/typeorm-migration.ts.ejs +18 -0
  201. package/generators/node-server/templates/server/vitest.config.e2e.ts.ejs +16 -0
  202. package/generators/node-server/templates/server/vitest.config.ts.ejs +16 -0
  203. package/generators/server/command.js +7 -0
  204. package/generators/server/generator.js +20 -0
  205. package/generators/server/generators/bootstrap/command.js +5 -0
  206. package/generators/server/generators/bootstrap/generator.js +15 -0
  207. package/generators/server/generators/bootstrap/index.js +2 -0
  208. package/generators/server/index.js +2 -0
  209. package/package.json +75 -4
@@ -0,0 +1,97 @@
1
+ # ===================================================================
2
+ # Configuration for the "prod" profile.
3
+ #
4
+ # This configuration overrides the application.yml file.
5
+ #
6
+ # More information on profiles: https://www.jhipster.tech/profiles/
7
+ # More information on configuration properties: https://www.jhipster.tech/common-application-properties/
8
+ # ===================================================================
9
+
10
+ # ===================================================================
11
+ # Standard app properties.
12
+ # ===================================================================
13
+
14
+ <%_ if (serviceDiscoveryEureka) { _%>
15
+ eureka:
16
+ instance:
17
+ prefer-ip-address: true
18
+ client:
19
+ service-url:
20
+ defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/
21
+
22
+ <%_ } _%>
23
+ <%_ if (serviceDiscoveryConsul) { _%>
24
+ cloud:
25
+ consul:
26
+ discovery:
27
+ prefer-ip-address: true
28
+
29
+ <%_ } _%>
30
+ # ===================================================================
31
+ # To enable TLS in production, activate the "tls" profile (BACKEND_ENV=prod,tls) with your own PKCS#12 keystore, see
32
+ # application-tls.yml. You can also use Let's Encrypt:
33
+ # https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm
34
+ # ===================================================================
35
+ # The level of the loggers, like Spring Boot: ROOT for the loggers without a level of their own, a logger by the
36
+ # context of its Nest logger (like AuthService: DEBUG). The logs page of the client changes them while it runs.
37
+ logging:
38
+ level:
39
+ ROOT: INFO
40
+
41
+ server:
42
+ port: <%= serverPort %>
43
+
44
+ # ===================================================================
45
+ # JHipster specific properties
46
+ #
47
+ # Full reference is available at: https://www.jhipster.tech/common-application-properties/
48
+ # ===================================================================
49
+
50
+ # The database, read by orm.config.ts (TypeORM options): environment variables override each property, like
51
+ # DATABASE_HOST or DATABASE_PASSWORD.
52
+ database:
53
+ type: <%= nodeProdDatabaseType %>
54
+ # The database of the host, like the datasource of JHipster Spring Boot: <%- dockerServicesDir %>app.yml sets the host of its service.
55
+ host: localhost
56
+ port: <%= nodeDatabasePort %>
57
+ <%_ if (databaseTypeSql) { _%>
58
+ # Samples of the username and the password are in the secret-samples profile: set them in production, with the
59
+ # DATABASE_USERNAME and DATABASE_PASSWORD environment variables for example.
60
+ username: ''
61
+ password: ''
62
+ name: <%- prodDatabaseName %>
63
+ <%_ } else { _%>
64
+ # Set the username and the password of a MongoDB with authentication, with the DATABASE_USERNAME and
65
+ # DATABASE_PASSWORD environment variables for example.
66
+ username: ''
67
+ password: ''
68
+ name: <%= baseName %>
69
+ <%_ } _%>
70
+ logging: false
71
+
72
+ <%_ if (generateUserManagement) { _%>
73
+ # The SMTP server of the account mails (activation, creation, password reset), read by the mail module
74
+ # (@nestjs-modules/mailer), like spring.mail of JHipster Spring Boot: environment variables override each property, like MAIL_HOST
75
+ # or MAIL_PASSWORD.
76
+ mail:
77
+ host: localhost
78
+ port: 25
79
+ username:
80
+ password:
81
+
82
+ <%_ } _%>
83
+ jhipster:
84
+ mail: # specific JHipster mail property, for standard properties see MailProperties
85
+ from: <%= baseName %>@localhost
86
+ base-url: http://my-server-url-to-change # Modify according to your server's URL
87
+
88
+ # ===================================================================
89
+ # Application specific properties
90
+ # Add your own application properties here, see the ApplicationProperties class
91
+ # to have type-safe configuration, like in the JHipsterProperties above
92
+ #
93
+ # More documentation is available at:
94
+ # https://www.jhipster.tech/common-application-properties/
95
+ # ===================================================================
96
+
97
+ # application:
@@ -0,0 +1,42 @@
1
+ # ===================================================================
2
+ # Configuration for the "secret-samples" profile.
3
+ #
4
+ # This configuration overrides the application.yml file.
5
+ #
6
+ # More information on profiles: https://www.jhipster.tech/profiles/
7
+ # More information on configuration properties: https://www.jhipster.tech/common-application-properties/
8
+ # ===================================================================
9
+
10
+ # ===================================================================
11
+ # Samples for required secrets to be used in development and ci using prod profile.
12
+ # ===================================================================
13
+
14
+ <%_ if (databaseTypeSql) { _%>
15
+ database:
16
+ username: <%- prodDatabaseUsername %>
17
+ password: '<%- prodDatabasePassword %>'
18
+
19
+ <%_ } _%>
20
+ jhipster:
21
+ security:
22
+ <%_ if (authenticationType === 'jwt') { _%>
23
+ authentication:
24
+ jwt:
25
+ # This token must be encoded using Base64 and be at least 512 bits long, like the HS512 key of JHipster Spring Boot (you can type `openssl rand -base64 64` on your command line to generate one)
26
+ base64-secret: <%= jwtSecretKey %>
27
+ <%_ } else if (authenticationTypeSession) { _%>
28
+ session:
29
+ secret: '<%= baseName %> session secret'
30
+ <%_ } else if (authenticationType === 'oauth2') { _%>
31
+ session:
32
+ secret: '<%= baseName %> session secret'
33
+ oauth2:
34
+ client:
35
+ provider:
36
+ oidc:
37
+ issuer-uri: http://localhost:9080/realms/jhipster
38
+ registration:
39
+ oidc:
40
+ client-id: web_app
41
+ client-secret: web_app
42
+ <%_ } _%>
@@ -0,0 +1,68 @@
1
+ # ===================================================================
2
+ # Configuration for the "test" profile.
3
+ #
4
+ # This configuration overrides the application.yml file.
5
+ #
6
+ # More information on profiles: https://www.jhipster.tech/profiles/
7
+ # More information on configuration properties: https://www.jhipster.tech/common-application-properties/
8
+ # ===================================================================
9
+
10
+ # ===================================================================
11
+ # Standard app properties.
12
+ # ===================================================================
13
+
14
+ <%_ if (serviceDiscoveryEureka) { _%>
15
+ eureka:
16
+ instance:
17
+ prefer-ip-address: true
18
+ client:
19
+ service-url:
20
+ defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/
21
+
22
+ <%_ } _%>
23
+ # The level of the loggers, like Spring Boot: ROOT for the loggers without a level of their own, a logger by the
24
+ # context of its Nest logger (like AuthService: DEBUG). The logs page of the client changes them while it runs.
25
+ logging:
26
+ level:
27
+ ROOT: WARN
28
+
29
+ server:
30
+ port: <%= serverPort %>
31
+
32
+ # ===================================================================
33
+ # JHipster specific properties
34
+ #
35
+ # Full reference is available at: https://www.jhipster.tech/common-application-properties/
36
+ # ===================================================================
37
+
38
+ # The database, read by orm.config.ts (TypeORM options): environment variables override each property, like
39
+ # DATABASE_HOST or DATABASE_PASSWORD.
40
+ database:
41
+ <%_ if (databaseTypeSql) { _%>
42
+ type: better-sqlite3
43
+ name: ':memory:'
44
+ # The schema of the migrations, like the Liquibase changelogs of the tests of JHipster Spring Boot.
45
+ synchronize: false
46
+ <%_ } else { _%>
47
+ type: mongodb
48
+ # An in-memory MongoDB server (mongodb-memory-server), started for each run.
49
+ embedded: true
50
+ synchronize: true
51
+ <%_ } _%>
52
+ logging: true
53
+
54
+ jhipster:
55
+ mail: # specific JHipster mail property, for standard properties see MailProperties
56
+ from: <%= baseName %>@localhost
57
+ base-url: http://127.0.0.1:<%= serverPort %>
58
+
59
+ # ===================================================================
60
+ # Application specific properties
61
+ # Add your own application properties here, see the ApplicationProperties class
62
+ # to have type-safe configuration, like in the JHipsterProperties above
63
+ #
64
+ # More documentation is available at:
65
+ # https://www.jhipster.tech/common-application-properties/
66
+ # ===================================================================
67
+
68
+ # application:
@@ -0,0 +1,15 @@
1
+ # ===================================================================
2
+ # Configuration for the "tls-samples" profile, used with the "tls" profile.
3
+ #
4
+ # The keystore is a self-signed sample generated by JHipster for development and tests: its password is public, so it
5
+ # gives a working https endpoint, not secrecy. Do not use it in production.
6
+ #
7
+ # As your browser will not trust its certificate, you will need to import it, or, with Chrome, enable the
8
+ # "allow-insecure-localhost" flag at chrome://flags/#allow-insecure-localhost
9
+ # ===================================================================
10
+ server:
11
+ ssl:
12
+ key-store: classpath:config/tls/keystore-samples.p12
13
+ key-store-password: password
14
+ key-store-type: PKCS12
15
+ key-alias: selfsigned
@@ -0,0 +1,15 @@
1
+ # ===================================================================
2
+ # Activate this profile to enable TLS (HTTPS).
3
+ #
4
+ # Provide your own PKCS#12 keystore, for example through the environment:
5
+ # SERVER_SSL_KEY_STORE, SERVER_SSL_KEY_STORE_PASSWORD
6
+ # In development, add the "tls-samples" profile instead: it uses the self-signed sample keystore generated by JHipster,
7
+ # whose password is public.
8
+ # ===================================================================
9
+ server:
10
+ ssl:
11
+ enabled: true
12
+ # A path relative to the working directory, or classpath:config/... for a file of the config folder.
13
+ # key-store: /path/to/keystore.p12
14
+ # key-store-password:
15
+ key-store-type: PKCS12
@@ -0,0 +1,149 @@
1
+ # ===================================================================
2
+ # Configuration.
3
+ #
4
+ # This configuration will be overridden by the profiles you activate with BACKEND_ENV (a comma separated list),
5
+ # for example application-dev.yml if you use the "dev" profile.
6
+ #
7
+ # More information on profiles: https://www.jhipster.tech/profiles/
8
+ # More information on configuration properties: https://www.jhipster.tech/common-application-properties/
9
+ # ===================================================================
10
+
11
+ # ===================================================================
12
+ # Standard app properties.
13
+ # ===================================================================
14
+
15
+ profiles:
16
+ # The profiles each profile activates, like spring.profiles.group of Spring Boot.
17
+ group:
18
+ dev:
19
+ - secret-samples
20
+ - api-docs
21
+ # Uncomment to activate TLS for the dev profile
22
+ #- tls
23
+ #- tls-samples
24
+ test:
25
+ - secret-samples
26
+
27
+ <%_ if (serviceDiscoveryEureka) { _%>
28
+ eureka:
29
+ client:
30
+ enabled: false
31
+ fetch-registry: true
32
+ register-with-eureka: true
33
+ instance-info-replication-interval-seconds: 10
34
+ registry-fetch-interval-seconds: 10
35
+ instance:
36
+ appname: <%= baseName %>
37
+ instanceId: <%= baseName %>:${random.value}
38
+ lease-renewal-interval-in-seconds: 5
39
+ lease-expiration-duration-in-seconds: 10
40
+ <%_ } _%>
41
+ <%_ if (serviceDiscoveryConsul) { _%>
42
+ # The registration in Consul, like the spring.cloud.consul properties of JHipster Spring Boot: enabled with
43
+ # CLOUD_CONSUL_ENABLED=true, at CLOUD_CONSUL_HOST and CLOUD_CONSUL_PORT.
44
+ cloud:
45
+ consul:
46
+ enabled: false
47
+ host: localhost
48
+ port: 8500
49
+ discovery:
50
+ service-name: <%= baseName.toLowerCase() %>
51
+ instance-id: <%= baseName.toLowerCase() %>:${random.value}
52
+ health-check-path: /management/health
53
+ health-check-interval: 10s
54
+ health-check-timeout: 5s
55
+ prefer-ip-address: false
56
+ <%_ } _%>
57
+
58
+ # The management endpoints, like Spring Boot Actuator: the values of the env and configprops endpoints (the
59
+ # configuration page of the client) are shown as ****** unless show-values is always.
60
+ management:
61
+ endpoint:
62
+ env:
63
+ show-values: never
64
+ configprops:
65
+ show-values: never
66
+
67
+ # ===================================================================
68
+ # JHipster specific properties
69
+ #
70
+ # Full reference is available at: https://www.jhipster.tech/common-application-properties/
71
+ # ===================================================================
72
+
73
+ jhipster:
74
+ clientApp:
75
+ name: '<%= frontendAppName %>'
76
+ # By default, CORS is disabled. Uncomment to enable.
77
+ # cors:
78
+ # allowed-origins: "http://localhost:8100,http://localhost:9000"
79
+ # allowed-methods: "*"
80
+ # allowed-headers: "*"
81
+ # exposed-headers: "Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params"
82
+ # allow-credentials: true
83
+ # max-age: 1800
84
+ <%_ if (serviceDiscoveryEureka) { _%>
85
+ registry:
86
+ password: admin
87
+ <%_ } _%>
88
+ security:
89
+ <%_ if (!skipClient) { _%>
90
+ # The Content-Security-Policy header of the responses, like JHipster Spring Boot.
91
+ content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'<%- locals.microfrontend && locals.clientFrameworkAngular ? ' blob:' : '' %> https://storage.googleapis.com; style-src 'self'<%- locals.clientThemeAny ? ' https://fonts.googleapis.com' : '' %> 'unsafe-inline'; img-src 'self' data:; font-src 'self'<%- locals.clientThemeAny ? ' https://fonts.gstatic.com' : '' %> data:"
92
+ <%_ } _%>
93
+ <%_ if (authenticationType === 'jwt') { _%>
94
+ authentication:
95
+ jwt:
96
+ # The secret of the tokens (base64-secret), a sample of the secret-samples profile: set it in production, with
97
+ # the JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64SECRET environment variable for example.
98
+ # Token is valid 24 hours
99
+ token-validity-in-seconds: 86400
100
+ token-validity-in-seconds-for-remember-me: 2592000
101
+ <%_ } else if (authenticationType === 'oauth2') { _%>
102
+ # The session secret and the OAuth2 client, samples of the secret-samples profile: set them in production, with
103
+ # environment variables like JHIPSTER_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENTSECRET.
104
+ oauth2:
105
+ # The audiences of the access tokens the API accepts as bearer tokens, comma separated, like JHipster Spring Boot:
106
+ # account for Keycloak, api://default for Okta.
107
+ audience: account,api://default
108
+ <%_ } _%>
109
+ mail:
110
+ from: <%= baseName %>@localhost
111
+ swagger:
112
+ default-include-pattern: /api/.*
113
+ title: <%= baseName %> API
114
+ description: <%= baseName %> API documentation
115
+ version: 0.0.1
116
+ terms-of-service-url:
117
+ contact-name:
118
+ contact-url:
119
+ contact-email:
120
+ license:
121
+ license-url:
122
+
123
+
124
+ # Properties to be exposed on the /management/info endpoint
125
+ info:
126
+ # Comma separated list of profiles that will trigger the ribbon to show
127
+ display-ribbon-on-profiles: 'dev'
128
+
129
+ <%_ if (serviceDiscoveryEureka) { _%>
130
+ cloud:
131
+ config:
132
+ uri: http://admin:${jhipster.registry.password}@localhost:8761/config
133
+ # name of the config server's property source (file.yml) that we want to use
134
+ name: <%= baseName %>
135
+ profile: prod # profile(s) of the property source
136
+ label: master # toggle to switch to a different version of the configuration as stored in git
137
+ # it can be set to any label, branch or commit of the configuration source Git repository
138
+ <%_ } _%>
139
+
140
+ # ===================================================================
141
+ # Application specific properties
142
+ # Add your own application properties here, see the ApplicationProperties class
143
+ # to have type-safe configuration, like in the JHipsterProperties above
144
+ #
145
+ # More documentation is available at:
146
+ # https://www.jhipster.tech/common-application-properties/
147
+ # ===================================================================
148
+
149
+ # application:
@@ -0,0 +1,81 @@
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+ import { ConfigModule, ConfigService } from '@nestjs/config';
3
+ import { Test } from '@nestjs/testing';
4
+ import { validateConfiguration } from './application-config.ts';
5
+ import { Config, config, configuration } from './config.ts';
6
+
7
+ describe('Config', () => {
8
+ const variables = [
9
+ 'JHIPSTER_MAIL_BASEURL',
10
+ 'JHIPSTER_MAIL_BASE_URL',
11
+ 'SAMPLE_INTERVALSECONDS',
12
+ 'SAMPLE_ENABLED',
13
+ ];
14
+
15
+ afterEach(() => {
16
+ for (const variable of variables) {
17
+ delete process.env[variable];
18
+ }
19
+ });
20
+
21
+ it('should keep the properties without environment variable', () => {
22
+ const config = new Config({ jhipster: { mail: { 'base-url': 'from-yaml' } } });
23
+ expect(config.get('jhipster.mail.base-url')).toBe('from-yaml');
24
+ });
25
+
26
+ it('should override a property with its canonical environment variable', () => {
27
+ process.env.JHIPSTER_MAIL_BASEURL = 'from-env';
28
+ const config = new Config({ jhipster: { mail: { 'base-url': 'from-yaml' } } });
29
+ expect(config.get('jhipster.mail.base-url')).toBe('from-env');
30
+ });
31
+
32
+ it('should override a property with the dashes as underscores', () => {
33
+ process.env.JHIPSTER_MAIL_BASE_URL = 'from-env';
34
+ const config = new Config({ jhipster: { mail: { 'base-url': 'from-yaml' } } });
35
+ expect(config.get('jhipster.mail.base-url')).toBe('from-env');
36
+ });
37
+
38
+ it('should keep the type of numbers and booleans', () => {
39
+ process.env.SAMPLE_INTERVALSECONDS = '60';
40
+ process.env.SAMPLE_ENABLED = 'false';
41
+ const config = new Config({ sample: { 'interval-seconds': 10, enabled: true } });
42
+ expect(config.get('sample.interval-seconds')).toBe(60);
43
+ expect(config.get('sample.enabled')).toBe(false);
44
+ });
45
+ });
46
+
47
+ describe('ConfigService', () => {
48
+ const createConfigService = async (): Promise<ConfigService> => {
49
+ const module = await Test.createTestingModule({
50
+ imports: [ConfigModule.forRoot({ ignoreEnvFile: true, load: [configuration] })],
51
+ }).compile();
52
+ return module.get(ConfigService);
53
+ };
54
+
55
+ it('should read the properties of config by their dotted names', async () => {
56
+ const configService = await createConfigService();
57
+ expect(configService.get('jhipster.clientApp.name')).toBe(config.get('jhipster.clientApp.name'));
58
+ expect(configService.get('server.port')).toBe(config.get('server.port'));
59
+ });
60
+
61
+ it('should read the properties added before the application is created, like the cloud config', async () => {
62
+ config.addAll({ sample: { 'added-later': 'from the cloud config' } });
63
+ const configService = await createConfigService();
64
+ expect(configService.get('sample.added-later')).toBe('from the cloud config');
65
+ });
66
+ });
67
+
68
+ describe('validateConfiguration', () => {
69
+ it('should accept the configuration of the application', () => {
70
+ expect(() => configuration()).not.toThrow();
71
+ });
72
+
73
+ it('should refuse an invalid property, telling the property and what it expects', () => {
74
+ const invalid = configuration() as any;
75
+ invalid.server.port = 'not a port';
76
+ invalid.jhipster.cors['max-age'] = -1;
77
+ expect(() => validateConfiguration(invalid)).toThrow(
78
+ /server\.port is "not a port", expected a port\n.*jhipster\.cors\.max-age is -1, expected a number of seconds/,
79
+ );
80
+ });
81
+ });