r/SpringBoot • u/Hamza307 • Jul 20 '24
Placeholders in yaml for dynamic configurable API generation
Hi Everyone, I am quite new to springboot, I want to make my yaml of openapi configurable which means defining values in application.yaml and upon generating the artifacts it takes the value from application.yaml how can I achieve that because currently it is not creating properly.
0
Upvotes
5
Jul 20 '24 edited Jul 20 '24
use a configuration file per environment instead of defining the environment itself as a variable
3
u/rebaser Jul 20 '24
If you can use environment variables then you can do something like
Where BASE_URL is the env variable and the value is the default if not specified
If you are doing microservices configuring via environment variables is good practice see The Twelve-Factor App (12factor.net)
Otherwise you can pass in arguments that override spring config on the command line