-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Change url for testing * Add launch darkly service * Update client * Install launch darkly into test projects * Logging to debug ld issue * Use feature toggles stub * Remove unneeded changes * Bumping chart version * Use passed in service id, case number and hearing ref id * code coverage issues * Rename * add logging * More logging * Inject url into pod to fix feature flagging not working in pr environment * Rename * Strip out special characters * Fix sonar cloud warnings * Remove logging * Remove Services from coverage exclusions * Revert yaml changes after testing --------- Co-authored-by: hmcts-ado-cnp <174565+hmcts-ado-cnp[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ba503ac
commit 13f5887
Showing
33 changed files
with
417 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using LaunchDarkly.Logging; | ||
using LaunchDarkly.Sdk; | ||
using LaunchDarkly.Sdk.Server; | ||
using LaunchDarkly.Sdk.Server.Interfaces; | ||
|
||
namespace VideoApi.Services | ||
{ | ||
public interface IFeatureToggles | ||
{ | ||
public bool HrsIntegrationEnabled(); | ||
} | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class FeatureToggles : IFeatureToggles | ||
{ | ||
private readonly ILdClient _ldClient; | ||
private readonly Context _context; | ||
private const string LdUser = "vh-video-api"; | ||
private const string HrsIntegrationEnabledToggleKey = "hrs-integration"; | ||
|
||
public FeatureToggles(string sdkKey, string environmentName) | ||
{ | ||
var config = Configuration.Builder(sdkKey) | ||
.Logging(Components.Logging(Logs.ToWriter(Console.Out)).Level(LogLevel.Warn)).Build(); | ||
_context = Context.Builder(LdUser).Name(environmentName).Build(); | ||
_ldClient = new LdClient(config); | ||
} | ||
|
||
public bool HrsIntegrationEnabled() | ||
{ | ||
if (!_ldClient.Initialized) | ||
{ | ||
throw new InvalidOperationException("LaunchDarkly client not initialized"); | ||
} | ||
|
||
return _ldClient.BoolVariation(HrsIntegrationEnabledToggleKey, _context); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace VideoApi.Services | ||
{ | ||
public class FeatureTogglesStub : IFeatureToggles | ||
{ | ||
public bool HrsIntegration { get; set; } = false; | ||
|
||
public bool HrsIntegrationEnabled() | ||
{ | ||
return HrsIntegration; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.