stable

Clone or download

Read-only

chore(forge-config): Generate database.inc without .inc.dist

In order to be able to generate the database.inc file without doing query/replace in .inc.dist file we need to be able to describe the variables completly using attributes. Hence introduce of default values and config help attributes. For default values, I propose to associate them to the a new attribute that define ConfigKey type. In the various attempts around this idea it seems to me that it's a good compromise between the amount of code to write for each config key and the ability to have working code when dealing with the config variables. An alternative can be seen here: Idadb114ddf06fb0c547211f524ed4089ad81a020 There is a special default value for "LegacyBool" because I do not want to break existing code that might rely on bool being strings ('1'). Part-of: story #22708 flexibility in the management of Tuleap Configuration Change-Id: If6a17aee930debe7e2ed93b3fc25f7f35b6be891

Modified Files

Name
A src/common/Config/ConfigKeyHelp.php +36 −0 Go to diff View file
A src/common/Config/ConfigKeyInt.php +51 −0 Go to diff View file
A src/common/Config/ConfigKeyLegacyBool.php +65 −0 Go to diff View file
A src/common/Config/ConfigKeyString.php +51 −0 Go to diff View file
A src/common/Config/ConfigKeyType.php +35 −0 Go to diff View file
A src/common/Config/ConfigValueDefaultValueAttributeProvider.php +61 −0 Go to diff View file
M src/common/Config/ConfigValueEnvironmentProvider.php +8 −23 Go to diff View file
A src/common/Config/ConstantWithConfigAttributesBuilder.php +55 −0 Go to diff View file
M src/common/Config/ForgeConfig.php +8 −2 Go to diff View file
M src/common/DB/DBConfig.php +18 −0 Go to diff View file
D src/etc/database.inc.dist +0 −37 Go to diff View file
M src/tuleap-cfg/Command/SetupMysql/DBSetupParameters.php +6 −6 Go to diff View file
M src/tuleap-cfg/Command/SetupMysql/DatabaseConfigurator.php +54 −33 Go to diff View file
M src/tuleap-cfg/Command/SetupMysql/MysqlCommandHelper.php +1 −1 Go to diff View file
M tests/unit/common/Config/ForgeConfigTest.php +10 −6 Go to diff View file
M tests/unit/tuleap-cfg/Command/SetupMysql/DBSetupParametersTest.php +42 −0 Go to diff View file
M tests/unit/tuleap-cfg/Command/SetupMysqlInitCommandAzureTest.php +3 −0 Go to diff View file
M tests/unit/tuleap-cfg/Command/SetupMysqlInitCommandTest.php +4 −1 Go to diff View file