OD1995
OD1995

Reputation: 1777

Setting properties in Spring Boot project for deployment to Google App Engine

I have a Spring Boot application that I'm looking to deploy to deploy to Google App Engine.

During development I set a number of values in my application.properties file (example below), found in src\main\resources. It seems that I need to store these values in a yaml file for GAE, but I haven't been able to find any documentation/examples of how to do this. I know there needs to be an app.yaml file and environment variables can be set it in, but are the application.properties values environment variables?

Also, I'd ideally like to be able to use the same setup for both production and development, but have different values (e.g. db connection values) depending on whether the app is in prod or development. Is that possible?

src\main\resources\application.properties

spring.datasource.url=jdbc:mysql://my_db_host:my_db_port/my_db_name
spring.datasource.username=my_username
spring.datasource.password=my_password
myapp.app.jwtExpirationMs= 3600000
myapp.app.refreshTokenExpirationMs= 2419200000
spring.mail.username = [email protected]
# etc etc

src\main\appengine\app.yaml

runtime: java11

instance_class: B1

basic_scaling:
  max_instances: 4

Upvotes: 0

Views: 442

Answers (1)

OD1995
OD1995

Reputation: 1777

I discovered you don't actually need to put your application.properties in an app.yaml file, they can stay in application.properties.

For having a dev/prod setup, this answered my question: Spring use one application.properties for production and another for debug

Upvotes: 1

Related Questions