0

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 = my_email@gmail.com
# etc etc

src\main\appengine\app.yaml

runtime: java11

instance_class: B1

basic_scaling:
  max_instances: 4
OD1995
  • 1,647
  • 4
  • 22
  • 52
  • Any update on this? I have similar issue in that I'm getting a communication exception to MySql when I deploy on google cloud but connection to database works find when run locally. – ProgrammingNewbie199 Jan 08 '23 at 05:51
  • @ProgrammingNewbie199 It turns out that you don't need to store the properties in `app.yaml`, they can stay in `applications.properties`. For prod/dev setup, I used this: https://stackoverflow.com/questions/34845990/spring-use-one-application-properties-for-production-and-another-for-debug – OD1995 Jan 09 '23 at 20:21
  • 1
    @OD1995, please post your answer so that it would be helpful for other community members with similar questions such as yours. – Robert G Jan 09 '23 at 21:20

1 Answers1

1

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

OD1995
  • 1,647
  • 4
  • 22
  • 52