Skip to content

Commit

Permalink
Added additional Spring profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
nhkhai committed May 2, 2024
1 parent 7b4b516 commit c15c7e3
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 0 deletions.
74 changes: 74 additions & 0 deletions src/main/resources/application-development.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
spring.application.name=smart-inventory

# Server Port Configuration.
# The default server port is 8080.
server.port=${PORT:9090}

# Database Configuration.
# PostgreSQL.
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/the_review_room}
# For WSL, use postgres.
# For Mac, use your Mac username.
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
# Password can be blank if we set it to trust in pg_hba.conf.
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:}

# Database platform to use.
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

# Hibernate Database Initialization Method.
# This will drop and create tables again.
spring.jpa.hibernate.ddl-auto=create
# This can be used to update tables.
# spring.jpa.hibernate.ddl-auto=update

# Logging configuration.
# Application logging configuration.
# logging.level.root=INFO
# logging.file.name=logs/application.log

# Database logging configuration.
# The Spring/Hibernate classes, which generate SQL statements and set the parameters, already contain the code for logging them.
# However, the level of those log statements is set to DEBUG and TRACE respectively, which is lower than the default level in Spring Boot — INFO.
# By adding these properties, we are just setting those loggers to the required level.
# For logging statements.
# logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG

# For logging parameters of prepared statements.
# logging.level.org.springframework.jdbc.core.StatementCreatorUtils=TRACE

# Set up a profile-specific configuration for tests. For example a <testloglevel> profile.
# logging.config=classpath:logback-testloglevel.xml

# SpringDoc Configuration.
# The OpenAPI descriptions are at /v3/api-docs, which is the default path: http://localhost:8080/v3/api-docs.
# For a custom path of the OpenAPI documentation in Json format,
# add the custom springdoc property /api-docs endpoint custom path to get the path: http://localhost:8080/api-docs.
springdoc.api-docs.path=/api-docs

# The OpenAPI definitions are in JSON format by default. For yaml format, we can obtain the definitions at: http://localhost:8080/api-docs.yaml.
# To disable api-docs springdoc-openapi endpoints.
# springdoc.api-docs.enabled=false

# The springdoc-openapi dependency already includes Swagger UI, to integrate springdoc-openapi with Swagger UI to interact with our API specification and exercise the endpoints.# We can access the API documentation at: http://localhost:8080/swagger-ui/index.html.
# Using swagger-ui properties, to customize the path of the swagger-ui API documentation swagger-ui-custom.html to get the path: http://localhost:8080/swagger-ui-custom.html.
# springdoc.swagger-ui.path=/swagger-ui-custom.html
springdoc.swagger-ui.path=/swagger-ui.html

# To sort the API paths according to their HTTP methods with the springdoc.swagger-ui.operationsSorter property.
# springdoc.swagger-ui.operationsSorter=method

# Jwt details.
# https://medium.com/code-with-farhan/spring-security-jwt-authentication-authorization-a2c6860be3cf
# jwt.session.period=60000

# Profile management.
# Spring Boot will always read the application.properties file.
# Other's profile files, such as application-development.properties only will complement and replace the properties defined before.
# The application.properties, and just this file, must have this line.
# [email protected]@
# Set the default active profile.
# Use the command to activate: mvn spring-boot:run -Dspring.profiles.active=development.
spring.profiles.active=${SPRING_PROFILES_ACTIVE:development}
# Set the default default profile. This is the profile that is used on any bean if you don't specify the @Profile annotation to be a certain profile.
# spring.profiles.default=development
74 changes: 74 additions & 0 deletions src/main/resources/application-production.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
spring.application.name=smart-inventory

# Server Port Configuration.
# The default server port is 8080.
server.port=${PORT:9090}

# Database Configuration.
# PostgreSQL.
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/the_review_room}
# For WSL, use postgres.
# For Mac, use your Mac username.
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
# Password can be blank if we set it to trust in pg_hba.conf.
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:}

# Database platform to use.
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect

# Hibernate Database Initialization Method.
# This will drop and create tables again.
spring.jpa.hibernate.ddl-auto=create
# This can be used to update tables.
# spring.jpa.hibernate.ddl-auto=update

# Logging configuration.
# Application logging configuration.
# logging.level.root=INFO
# logging.file.name=logs/application.log

# Database logging configuration.
# The Spring/Hibernate classes, which generate SQL statements and set the parameters, already contain the code for logging them.
# However, the level of those log statements is set to DEBUG and TRACE respectively, which is lower than the default level in Spring Boot — INFO.
# By adding these properties, we are just setting those loggers to the required level.
# For logging statements.
# logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG

# For logging parameters of prepared statements.
# logging.level.org.springframework.jdbc.core.StatementCreatorUtils=TRACE

# Set up a profile-specific configuration for tests. For example a <testloglevel> profile.
# logging.config=classpath:logback-testloglevel.xml

# SpringDoc Configuration.
# The OpenAPI descriptions are at /v3/api-docs, which is the default path: http://localhost:8080/v3/api-docs.
# For a custom path of the OpenAPI documentation in Json format,
# add the custom springdoc property /api-docs endpoint custom path to get the path: http://localhost:8080/api-docs.
springdoc.api-docs.path=/api-docs

# The OpenAPI definitions are in JSON format by default. For yaml format, we can obtain the definitions at: http://localhost:8080/api-docs.yaml.
# To disable api-docs springdoc-openapi endpoints.
# springdoc.api-docs.enabled=false

# The springdoc-openapi dependency already includes Swagger UI, to integrate springdoc-openapi with Swagger UI to interact with our API specification and exercise the endpoints.# We can access the API documentation at: http://localhost:8080/swagger-ui/index.html.
# Using swagger-ui properties, to customize the path of the swagger-ui API documentation swagger-ui-custom.html to get the path: http://localhost:8080/swagger-ui-custom.html.
# springdoc.swagger-ui.path=/swagger-ui-custom.html
springdoc.swagger-ui.path=/swagger-ui.html

# To sort the API paths according to their HTTP methods with the springdoc.swagger-ui.operationsSorter property.
# springdoc.swagger-ui.operationsSorter=method

# Jwt details.
# https://medium.com/code-with-farhan/spring-security-jwt-authentication-authorization-a2c6860be3cf
# jwt.session.period=60000

# Profile management.
# Spring Boot will always read the application.properties file.
# Other's profile files, such as application-development.properties only will complement and replace the properties defined before.
# The application.properties, and just this file, must have this line.
# [email protected]@
# Set the default active profile.
# Use the command to activate: mvn spring-boot:run -Dspring.profiles.active=development.
spring.profiles.active=${SPRING_PROFILES_ACTIVE:development}
# Set the default default profile. This is the profile that is used on any bean if you don't specify the @Profile annotation to be a certain profile.
# spring.profiles.default=development

0 comments on commit c15c7e3

Please sign in to comment.