Merge pull request #20 from smthbh/Feature-FeatureFlags

Add feature flags
This commit is contained in:
Brad 2025-06-21 16:32:45 -04:00 committed by GitHub
commit 3afbfba0d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 38 additions and 8 deletions

View file

@ -23,3 +23,6 @@ ACORE_ARMORY_WORLD_DATABASE__USER="acore"
ACORE_ARMORY_WORLD_DATABASE__PASSWORD="acore"
ACORE_ARMORY_WORLD_DATABASE__DATABASE="acore_world"
ACORE_ARMORY_DB_QUERY_TIMEOUT=10000
ACORE_ARMORY_FEATURE_FLAGS__ENABLE_QUESTS_PAGE=1
ACORE_ARMORY_FEATURE_FLAGS__ENABLE_SKILLS_PAGE=1
ACORE_ARMORY_FEATURE_FLAGS__ENABLE_REPUTATION_PAGE=1

View file

@ -33,5 +33,10 @@
"password": "acore",
"database": "acore_world"
},
"dbQueryTimeout": 10000
"dbQueryTimeout": 10000,
"featureFlags": {
"enableQuestsPage": true,
"enableReputationPage": true,
"enableSkillsPage": true
}
}

View file

@ -191,13 +191,19 @@ export class Armory {
await charsController.load();
app.get("/character/:realm/:name", this.wrapRoute(charsController.character.bind(charsController)));
app.get("/character/:realm/:name/talents", this.wrapRoute(charsController.talents.bind(charsController)));
app.get("/character/:realm/:name/skills", this.wrapRoute(charsController.skills.bind(charsController)));
if (this.config.featureFlags.enableSkillsPage) {
app.get("/character/:realm/:name/skills", this.wrapRoute(charsController.skills.bind(charsController)));
}
app.get("/character/:realm/:name/achievements", this.wrapRoute(charsController.achievements.bind(charsController)));
app.get("/character/:realm/:character/achievements/data", this.wrapRoute(charsController.achievementsData.bind(charsController)));
app.get("/character/:realm/:name/pvp", this.wrapRoute(charsController.pvp.bind(charsController)));
app.get("/character/:realm/:name/reputation", this.wrapRoute(charsController.reputation.bind(charsController)));
app.get("/character/:realm/:name/quests", this.wrapRoute(charsController.quests.bind(charsController)));
app.get("/character/:realm/:name/quests/compare/:otherRealm/:otherName", this.wrapRoute(charsController.questsCompare.bind(charsController)));
if (this.config.featureFlags.enableReputationPage) {
app.get("/character/:realm/:name/reputation", this.wrapRoute(charsController.reputation.bind(charsController)));
}
if (this.config.featureFlags.enableQuestsPage) {
app.get("/character/:realm/:name/quests", this.wrapRoute(charsController.quests.bind(charsController)));
app.get("/character/:realm/:name/quests/compare/:otherRealm/:otherName", this.wrapRoute(charsController.questsCompare.bind(charsController)));
}
const guildsController = new GuildController(this);
app.get("/guild/:realm/:name", this.wrapRoute(guildsController.guild.bind(guildsController)));

View file

@ -23,6 +23,12 @@ export interface IIframeModeConfig {
url: string;
}
export interface IFeatureFlags {
enableQuestsPage: boolean;
enableReputationPage: boolean;
enableSkillsPage: boolean;
}
export class Config {
public aowowUrl: string;
public wowheadUrl: string;
@ -37,6 +43,7 @@ export class Config {
public realms: IRealmConfig[];
public worldDatabase: IDatabaseConfig;
public dbQueryTimeout: number;
public featureFlags: IFeatureFlags;
private static envPrefix = "ACORE_ARMORY";
private static checkedMissingField = false;

View file

@ -789,6 +789,9 @@ export class CharacterController {
guild: charData.guild,
zone: charData.zone,
zoneName: this.getZoneName(charData.zone),
enableQuestsPage: this.armory.config.featureFlags.enableQuestsPage,
enableSkillsPage: this.armory.config.featureFlags.enableSkillsPage,
enableReputationPage: this.armory.config.featureFlags.enableReputationPage
};
}

View file

@ -3,9 +3,15 @@
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}">Character</a>&emsp;
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/talents">Talents</a>&emsp;
{{#if enableSkillsPage}}
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/skills">Skills</a>&emsp;
{{/if}}
{{#if enableReputationPage}}
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/reputation">Reputation</a>&emsp;
{{/if}}
{{#if enableQuestsPage}}
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/quests">Quests</a>&emsp;
{{/if}}
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/achievements">Achievements</a>&emsp;
<a href="{{websiteRoot}}/character/{{realm}}/{{name}}/pvp">PvP</a>&emsp;
<br>
@ -27,7 +33,7 @@
{{else}}
Offline 🔴
{{/if}}
- <a href="{{wowhead}}/zone={{zone}}">
<a href="{{wowhead}}/zone={{zone}}">
{{#if zoneName}}
{{zoneName}}
{{/if}}