Intro
This module is used to set global configuration on application. This is achieved by generating class with configuration (GlobalConfiguration)
For generation, a special utility project was created with the name configuration-generator
Run from CLI
To generate GlobalConfiguration class you need open a terminal and enter this command:
Code Block | ||
---|---|---|
| ||
cmd/app generate cfg |
Info |
---|
All comands related to generation you can find in this file cmd/app |
After generation, this class with can be reused throughout the project
Example of use in flyway configuration:
Code Block | ||
---|---|---|
| ||
GlobalConfiguration.Postgres postgres = globalConfiguration.postgres();
FluentConfiguration fluentConfiguration = Flyway.configure()
.dataSource(postgres.jdbcUrl(), postgres.users().flyway(), postgres.passwords().flyway())
.sqlMigrationPrefix("")
.locations(postgres.locationMigration())
.baselineOnMigrate(true);
Flyway flyway = fluentConfiguration.load();
flyway.migrate(); |
Info |
---|
Where we connect GlobalConfiguration as a bean and get a subclass postgres() with all the setting for the database |