Skip to content

Commit

Permalink
fix: not loading jwt secret from file
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Jan 28, 2023
1 parent fa0f11d commit 34d5038
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions Oxide.Ext.GamingApi/GamingApiNats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private GamingApiNats(LoggingInterface logger)
{
// get a private key seed from your environment.
string seed = this.GetNatsJwtSeed();
this.Logger.Info("NATS: Loading jwt seed : " + seed.Substring(0, 3));
this.Logger.Info("NATS: Loading jwt seed : " + seed.Substring(seed.Length-4, seed.Length-1));

// Generate a NkeyPair
NkeyPair kp = Nkeys.FromSeed(seed);
Expand Down Expand Up @@ -167,16 +167,6 @@ private string GetNatsNkeyUser()
private string GetNatsNkeySeed()
{
var envName = $"GAMINGAPI_NATS_NKEY_SEED";
var envFileName = envName + "_FILE";

var fileName = Environment.GetEnvironmentVariable(envFileName);
if (fileName != null)
{
this.Logger.Info($"NATS: {envFileName} loading from file");
string contents = File.ReadAllText(@fileName);
return contents;
}

var value = Environment.GetEnvironmentVariable(envName);
this.Logger.Info($"NATS: {envName} loading");
if (value == null)
Expand Down Expand Up @@ -214,6 +204,15 @@ private string GetNatsJwtUser()
private string GetNatsJwtSeed()
{
var envName = $"GAMINGAPI_NATS_JWT_SEED";
var envFileName = envName + "_FILE";

var fileName = Environment.GetEnvironmentVariable(envFileName);
if (fileName != null)
{
this.Logger.Info($"NATS: {envFileName} loading from file");
string contents = File.ReadAllText(@fileName);
return contents;
}
var value = Environment.GetEnvironmentVariable(envName);
if (value == null)
{
Expand Down

0 comments on commit 34d5038

Please sign in to comment.