Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "primary.crt", templates.graphql.primaryCrt.template());
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "secondary.crt", templates.graphql.secondaryCrt.template());

// added with #471
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "app-status.yml", templates.graphql.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.graphql.values.template());

// logging
transfer(targetPath, ("src.main.resources").replace(".", separator), "logback.xml", templates.graphql.logback.template());
transfer(targetPath, ("src.test.resources").replace(".", separator), "logback-test.xml", templates.graphql.logback.template());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Put your application specific error code into this file instead of status.yml
# This file will be merge into the status.yml during the server startup.
# Please allocate the range for the application error codes within your organization
# to ensure no reused for an error code across the organization for tracing.

# 20000-29999 common error codes within your business domain.
# It is highly recommended to have common error codes shared within your organization
# or your line of business and put them into the externalized status.yml file.

# 30000-99999 customize error code that cannot be found in common range.
# Only use this section if you cannot make your error code into 20000-29999 range on time.
# In this case, the error code defined here will be merged to the status.yml during startup.
# To ensure there is no reuse of error code, this application will use the range 30000-31000.
ERR30000:
statusCode: 400
code: ERR30000
message: FIRST_ERROR_IN_APP
description: This is is the first error in this example application.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ request:
resetTimeout: ${client.resetTimeout:7000}
# if open tracing is enable. traceability, correlation and metrics should not be in the chain if opentracing is used.
injectOpenTracing: ${client.injectOpenTracing:false}
# inject serviceId as callerId into the http header for metrics to collect the caller. The serviceId is from server.yml
injectCallerId: ${client.injectCallerId:false}
# the flag to indicate whether http/2 is enabled when calling client.callService()
enableHttp2: ${client.enableHttp2:true}
# the maximum host capacity of connection pool
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#--------------------------------------------------------------------------------
# values.yml : Set of values commonly overridden in microservices
# The file can be extended with other elements, as necessary
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# client.yml
#--------------------------------------------------------------------------------
# key distribution server url
# client.server_url: set-real-value-here
# client_id used to access key distribution service. It can be the same client_id with token service or not.
# client.client_id: set-real-value-here

#--------------------------------------------------------------------------------
# server.yml
#--------------------------------------------------------------------------------
# Https port if enableHttps is true. It will be ignored if dynamicPort is true
# server.httpsPort: 8443

# Enable HTTPS should be true on official environment and most dev environments.
# server.enableHttps: true

# Http/2 is enabled by default for better performance and it works with the client module.
# server.enableHttp2: true

# Minimum port range. This define a range for the dynamic allocated ports so that it is easier to setup
# firewall rule to enable this range. Default 2400 to 2500 block has 100 port numbers and should be
# enough for most cases unless you are using a big bare metal box as Kubernetes node that can run 1000s pods
server.minPort: 2400

# Maximum port rang. The range can be customized to adopt your network security policy and can be increased or
# reduced to ease firewall rules.
server.maxPort: 2500

# environment tag that will be registered on consul to support multiple instances per env for testing.
# https://github.com/networknt/light-doc/blob/master/docs/content/design/env-segregation.md
# This tag should only be set for testing env, not production. The production certification process will enforce it.
server.environment: dev

# Build number, to be set by teams for auditing purposes.
# Allows teams to audit the value and set it according to their release management processes
server.buildNumber: latest

#--------------------------------------------------------------------------------
# security.yml
#--------------------------------------------------------------------------------
# Enable JWT verification flag.
# security.enableVerifyJwt: true

#--------------------------------------------------------------------------------
# datasource.yml
#--------------------------------------------------------------------------------
# datasource.jdbcUrl: set-real-value-here
# datasource.username: set-real-value-here

# datasource.maximumPoolSize: set-real-value-here
# datasource.prepStmtCacheSize: set-real-value-here
# datasource.prepStmtCacheSqlLimit: set-real-value-here
# datasource.conectionTimeout: set-real-value-here

#--------------------------------------------------------------------------------
# secret.yml
#--------------------------------------------------------------------------------
# Sever section
# Key store password, the path of keystore is defined in server.yml
# secret.serverKeystorePass: set-real-value-here
# Key password, the key is in keystore
# secret.serverKeyPass: set-real-value-here
# Trust store password, the path of truststore is defined in server.yml
# secret.serverTruststorePass: set-real-value-here

# Client section
# Key store password, the path of keystore is defined in server.yml
# secret.clientKeystorePass: set-real-value-here
# Key password, the key is in keystore
# secret.clientKeyPass: set-real-value-here
# Trust store password, the path of truststore is defined in server.yml
# secret.clientTruststorePass: set-real-value-here
# Authorization code client secret for OAuth2 server
# secret.authorizationCodeClientSecret: set-real-value-here
# Client credentials client secret for OAuth2 server
# secret.clientCredentialsClientSecret: set-real-value-here
# Fresh token client secret for OAuth2 server
# secret.refreshTokenClientSecret: set-real-value-here
# Key distribution client secret for OAuth2 server
# secret.keyClientSecret: set-real-value-here

# Consul section
# Consul Token for service registry and discovery
# secret.consulToken: set-real-value-here

# EmailSender password
# secret.emailPassword: set-real-value-here

# Database Section
# secret.mysqlDatabasePassword: set-real-value-here
# secret.oracleDatabasePassword: set-real-value-here

# Service Singletons
service.singletons:
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep
transfer(targetPath, ("src.main.resources").replace(".", separator), "logback.xml", templates.hybrid.logback.template());
transfer(targetPath, ("src.test.resources").replace(".", separator), "logback-test.xml", templates.hybrid.logback.template());

// added with #471
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "app-status.yml", templates.hybrid.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template());

// transfer binary files without touching them.
try (InputStream is = HybridServerGenerator.class.getResourceAsStream("/binaries/server.keystore")) {
Files.copy(is, Paths.get(targetPath, ("src.main.resources.config").replace(".", separator), "server.keystore"), StandardCopyOption.REPLACE_EXISTING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep
// logging
transfer(targetPath, ("src.main.resources").replace(".", separator), "logback.xml", templates.hybrid.logback.template());
transfer(targetPath, ("src.test.resources").replace(".", separator), "logback-test.xml", templates.hybrid.logback.template());
// added with #471
transfer(targetPath, ("src.test.resources.config").replace(".", separator), "app-status.yml", templates.hybrid.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
transfer(targetPath, ("src.test.resources.config").replace(".", separator), "values.yml", templates.hybrid.values.template());

// handler
Map<String, Object> services = new HashMap<String, Object>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Put your application specific error code into this file instead of status.yml
# This file will be merge into the status.yml during the server startup.
# Please allocate the range for the application error codes within your organization
# to ensure no reused for an error code across the organization for tracing.

# 20000-29999 common error codes within your business domain.
# It is highly recommended to have common error codes shared within your organization
# or your line of business and put them into the externalized status.yml file.

# 30000-99999 customize error code that cannot be found in common range.
# Only use this section if you cannot make your error code into 20000-29999 range on time.
# In this case, the error code defined here will be merged to the status.yml during startup.
# To ensure there is no reuse of error code, this application will use the range 30000-31000.
ERR30000:
statusCode: 400
code: ERR30000
message: FIRST_ERROR_IN_APP
description: This is is the first error in this example application.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ request:
resetTimeout: ${client.resetTimeout:7000}
# if open tracing is enable. traceability, correlation and metrics should not be in the chain if opentracing is used.
injectOpenTracing: ${client.injectOpenTracing:false}
# inject serviceId as callerId into the http header for metrics to collect the caller. The serviceId is from server.yml
injectCallerId: ${client.injectCallerId:false}
# the flag to indicate whether http/2 is enabled when calling client.callService()
enableHttp2: ${client.enableHttp2:true}
# the maximum host capacity of connection pool
Expand Down
100 changes: 100 additions & 0 deletions light-hybrid-4j/src/main/resources/templates/hybrid/values.rocker.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#--------------------------------------------------------------------------------
# values.yml : Set of values commonly overridden in microservices
# The file can be extended with other elements, as necessary
#--------------------------------------------------------------------------------

#--------------------------------------------------------------------------------
# client.yml
#--------------------------------------------------------------------------------
# key distribution server url
# client.server_url: set-real-value-here
# client_id used to access key distribution service. It can be the same client_id with token service or not.
# client.client_id: set-real-value-here

#--------------------------------------------------------------------------------
# server.yml
#--------------------------------------------------------------------------------
# Https port if enableHttps is true. It will be ignored if dynamicPort is true
# server.httpsPort: 8443

# Enable HTTPS should be true on official environment and most dev environments.
# server.enableHttps: true

# Http/2 is enabled by default for better performance and it works with the client module.
# server.enableHttp2: true

# Minimum port range. This define a range for the dynamic allocated ports so that it is easier to setup
# firewall rule to enable this range. Default 2400 to 2500 block has 100 port numbers and should be
# enough for most cases unless you are using a big bare metal box as Kubernetes node that can run 1000s pods
server.minPort: 2400

# Maximum port rang. The range can be customized to adopt your network security policy and can be increased or
# reduced to ease firewall rules.
server.maxPort: 2500

# environment tag that will be registered on consul to support multiple instances per env for testing.
# https://github.com/networknt/light-doc/blob/master/docs/content/design/env-segregation.md
# This tag should only be set for testing env, not production. The production certification process will enforce it.
server.environment: dev

# Build number, to be set by teams for auditing purposes.
# Allows teams to audit the value and set it according to their release management processes
server.buildNumber: latest

#--------------------------------------------------------------------------------
# security.yml
#--------------------------------------------------------------------------------
# Enable JWT verification flag.
# security.enableVerifyJwt: true

#--------------------------------------------------------------------------------
# datasource.yml
#--------------------------------------------------------------------------------
# datasource.jdbcUrl: set-real-value-here
# datasource.username: set-real-value-here

# datasource.maximumPoolSize: set-real-value-here
# datasource.prepStmtCacheSize: set-real-value-here
# datasource.prepStmtCacheSqlLimit: set-real-value-here
# datasource.conectionTimeout: set-real-value-here

#--------------------------------------------------------------------------------
# secret.yml
#--------------------------------------------------------------------------------
# Sever section
# Key store password, the path of keystore is defined in server.yml
# secret.serverKeystorePass: set-real-value-here
# Key password, the key is in keystore
# secret.serverKeyPass: set-real-value-here
# Trust store password, the path of truststore is defined in server.yml
# secret.serverTruststorePass: set-real-value-here

# Client section
# Key store password, the path of keystore is defined in server.yml
# secret.clientKeystorePass: set-real-value-here
# Key password, the key is in keystore
# secret.clientKeyPass: set-real-value-here
# Trust store password, the path of truststore is defined in server.yml
# secret.clientTruststorePass: set-real-value-here
# Authorization code client secret for OAuth2 server
# secret.authorizationCodeClientSecret: set-real-value-here
# Client credentials client secret for OAuth2 server
# secret.clientCredentialsClientSecret: set-real-value-here
# Fresh token client secret for OAuth2 server
# secret.refreshTokenClientSecret: set-real-value-here
# Key distribution client secret for OAuth2 server
# secret.keyClientSecret: set-real-value-here

# Consul section
# Consul Token for service registry and discovery
# secret.consulToken: set-real-value-here

# EmailSender password
# secret.emailPassword: set-real-value-here

# Database Section
# secret.mysqlDatabasePassword: set-real-value-here
# secret.oracleDatabasePassword: set-real-value-here

# Service Singletons
service.singletons:
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public void generate(final String targetPath, Object model, Any config) throws I
specChangeCodeReGenOnly = config.toBoolean("specChangeCodeReGenOnly");
enableParamDescription = config.toBoolean("enableParamDescription");
skipPomFile = config.toBoolean("skipPomFile");

generateValuesYml = config.toBoolean("generateValuesYml");
String artifactId = config.toString("artifactId");
String version = config.toString("version").trim();
String serviceId = config.get("groupId").toString().trim() + "." + artifactId.trim() + "-" + config.get("version").toString().trim();
Expand Down Expand Up @@ -203,11 +201,10 @@ public void generate(final String targetPath, Object model, Any config) throws I
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "sanitizer.yml", templates.rest.sanitizerYml.template());
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "traceability.yml", templates.rest.traceabilityYml.template());
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "health.yml", templates.rest.healthYml.template());

// values.yml file, transfer only if explicitly set in the config.json
if (generateValuesYml) {
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.rest.openapi.values.template());
}
// added with #471
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "app-status.yml", templates.rest.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.rest.openapi.values.template());
}
// routing handler
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "handler.yml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep
skipServerInfo = config.toBoolean("skipServerInfo");
regenerateCodeOnly = config.toBoolean("specChangeCodeReGenOnly");
enableParamDescription = config.toBoolean("enableParamDescription");

generateValuesYml = config.toBoolean("generateValuesYml");

String version = config.toString("version").trim();
String serviceId = config.get("groupId").toString().trim() + "." + config.get("artifactId").toString().trim() + "-" + config.get("version").toString().trim();

Expand Down Expand Up @@ -171,10 +168,10 @@ public void generate(String targetPath, Object model, Any config) throws IOExcep

// exclusion list for Config module
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "config.yml", templates.restkotlin.openapi.config.template());

// values.yml file, transfer only if explicitly set in the config.json
if(generateValuesYml)
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.restkotlin.openapi.values.template());
// added with #471
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "app-status.yml", templates.restkotlin.appStatusYml.template());
// values.yml file, transfer to suppress the warning message during start startup and encourage usage.
transfer(targetPath, ("src.main.resources.config").replace(".", separator), "values.yml", templates.restkotlin.openapi.values.template());
}
}

Expand Down
Loading