Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 6e627d3

Browse files
committed
Auto Register Key from Env Vars
1 parent e910e31 commit 6e627d3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ServiceStack.Text/PclExport.NetStandard.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ public override string[] GetDirectoryNames(string dirPath, string searchPattern
113113
: Directory.GetDirectories(dirPath);
114114
}
115115

116+
public const string AppSettingsKey = "servicestack:license";
117+
public const string EnvironmentKey = "SERVICESTACK_LICENSE";
118+
119+
public override void RegisterLicenseFromConfig()
120+
{
121+
//Automatically register license key stored in <appSettings/> is done in .NET Core AppHost
122+
123+
//or SERVICESTACK_LICENSE Environment variable
124+
var licenceKeyText = GetEnvironmentVariable(EnvironmentKey);
125+
if (!string.IsNullOrEmpty(licenceKeyText))
126+
{
127+
LicenseUtils.RegisterLicense(licenceKeyText);
128+
}
129+
}
130+
116131
public override string MapAbsolutePath(string relativePath, string appendPartialPathModifier)
117132
{
118133
if (relativePath.StartsWith("~"))

0 commit comments

Comments
 (0)