Skip to content

Commit 72314a0

Browse files
Copilotreakaleek
andauthored
Add staging elastic nav feature flag for edge environment (#1908)
* Initial plan * Add staging elastic nav feature flag for edge environment Co-authored-by: reakaleek <[email protected]> * Remove FeatureFlagsTests.cs file as requested Co-authored-by: reakaleek <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: reakaleek <[email protected]> Co-authored-by: Jan Calanog <[email protected]>
1 parent 2f79cb3 commit 72314a0

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

config/assembler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ environments:
3030
feature_flags:
3131
LAZY_LOAD_NAVIGATION: true
3232
SEARCH_OR_ASK_AI: true
33+
STAGING_ELASTIC_NAV: true
3334
dev:
3435
uri: http://localhost:4000
3536
content_source: current

src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ public bool SearchOrAskAiEnabled
3838
set => _featureFlags["search-or-ask-ai"] = value;
3939
}
4040

41+
public bool StagingElasticNavEnabled
42+
{
43+
get => IsEnabled("staging-elastic-nav");
44+
set => _featureFlags["staging-elastic-nav"] = value;
45+
}
46+
4147
private bool IsEnabled(string key)
4248
{
4349
var envKey = $"FEATURE_{key.ToUpperInvariant().Replace('-', '_')}";

src/Elastic.Documentation.Site/Layout/_Header.cshtml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
{
44
<div id="elastic-nav-wrapper">
55
<div id="elastic-nav" hx-disable="true"></div>
6-
<script src="https://www.elastic.co/elastic-nav.js" async></script>
6+
@{
7+
var elasticNavUrl = Model.Features.StagingElasticNavEnabled
8+
? "https://stag-www.elastic.co/elastic-nav.js"
9+
: "https://www.elastic.co/elastic-nav.js";
10+
}
11+
<script src="@elasticNavUrl" async></script>
712
</div>
813
@await RenderPartialAsync(_SecondaryNav.Create(Model))
914
}

0 commit comments

Comments
 (0)