[AB-190] migrating default config (featureMode, system config, post targets, feature flags) from tables to property files

not longer immediately instantiating the feature flag instance when a new server is found, but only when its config is changed or when a feature mod has its config changed
This commit is contained in:
Sheldan
2021-02-11 00:09:58 +01:00
parent ea12d67e5f
commit 047c574319
98 changed files with 654 additions and 1356 deletions

View File

@@ -0,0 +1,10 @@
package dev.sheldan.abstracto.statistic.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource("classpath:statistic-config.properties")
public class StatisticConfig {
}

View File

@@ -7,7 +7,7 @@
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="statisticModule" value="(SELECT id FROM module WHERE name = 'statistic')"/>
<property name="emoteTrackingFeature" value="(SELECT id FROM feature WHERE key = 'emote_tracking')"/>
<property name="emoteTrackingFeature" value="(SELECT id FROM feature WHERE key = 'emoteTracking')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="statistic-commands">

View File

@@ -8,8 +8,6 @@
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<include file="feature.xml" relativeToChangelogFile="true"/>
<include file="module.xml" relativeToChangelogFile="true"/>
<include file="default_feature_flag.xml" relativeToChangelogFile="true"/>
<include file="emote_statistic_job.xml" relativeToChangelogFile="true"/>
<include file="command.xml" relativeToChangelogFile="true"/>
<include file="default_feature_mode.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -1,18 +0,0 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="emoteTrackingFeature" value="(SELECT id FROM feature WHERE key = 'emote_tracking')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="emote_tracking_default_feature_flag-insertion">
<insert tableName="default_feature_flag">
<column name="enabled" value="false"/>
<column name="feature_id" valueComputed="${emoteTrackingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -1,31 +0,0 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<property name="emoteTrackingFeature" value="(SELECT id FROM feature WHERE key = 'emote_tracking')"/>
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="emote_tracking_default_feature_mode-insertion">
<insert tableName="default_feature_mode">
<column name="enabled" value="true"/>
<column name="mode" value="emoteAutoTrack"/>
<column name="feature_id" valueComputed="${emoteTrackingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_mode">
<column name="enabled" value="false"/>
<column name="mode" value="externalEmotes"/>
<column name="feature_id" valueComputed="${emoteTrackingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
<insert tableName="default_feature_mode">
<column name="enabled" value="false"/>
<column name="mode" value="autoTrackExternal"/>
<column name="feature_id" valueComputed="${emoteTrackingFeature}" />
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -9,7 +9,7 @@
<property name="today" value="(SELECT NOW())"/>
<changeSet author="Sheldan" id="emote_tracking_feature-insertion">
<insert tableName="feature">
<column name="key" value="emote_tracking"/>
<column name="key" value="emoteTracking"/>
<column name="created" valueComputed="${today}"/>
</insert>
</changeSet>

View File

@@ -0,0 +1,15 @@
abstracto.featureFlags.assignableRole.featureName=assignableRole
abstracto.featureFlags.assignableRole.enabled=false
abstracto.featureModes.emoteAutoTrack.featureName=emoteTracking
abstracto.featureModes.emoteAutoTrack.mode=emoteAutoTrack
abstracto.featureModes.emoteAutoTrack.enabled=true
abstracto.featureModes.externalEmotes.featureName=emoteTracking
abstracto.featureModes.externalEmotes.mode=externalEmotes
abstracto.featureModes.externalEmotes.enabled=false
abstracto.featureModes.autoTrackExternal.featureName=emoteTracking
abstracto.featureModes.autoTrackExternal.mode=autoTrackExternal
abstracto.featureModes.autoTrackExternal.enabled=false

View File

@@ -9,7 +9,7 @@ public enum StatisticFeatures implements FeatureEnum {
/**
* Feature responsible to track the emotes used in a message on a server.
*/
EMOTE_TRACKING("emote_tracking");
EMOTE_TRACKING("emoteTracking");
private final String key;