Skip to content

Commit b9eb3b4

Browse files
App data: optionally specify path from environment variable
1 parent adfdf44 commit b9eb3b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Certify.Shared/Utils/EnvironmentUtil.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,19 @@ private static void CreateAndApplyRestrictedACL(string path)
8787
/// <returns>full app data with with optional subdirectory</returns>
8888
public static string CreateAppDataPath(string subDirectory = null, bool skipCreation = false)
8989
{
90+
// use the environment variable CERTIFY_APPDATA_PATH if set, otherwise use the common app data folder
9091
var parts = new List<string>()
9192
{
9293
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
9394
Models.SharedConstants.APPDATASUBFOLDER
9495
};
9596

97+
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CERTIFY_APPDATA_PATH")))
98+
{
99+
parts = new List<string> { Environment.GetEnvironmentVariable("CERTIFY_APPDATA_PATH") };
100+
}
101+
102+
// if per instance settings are enabled, include the machine name in the path
96103
if (Environment.GetEnvironmentVariable("CERTIFY_ENABLE_PER_INSTANCE_SETTINGS")?.ToLowerInvariant() == "true")
97104
{
98105
parts.Add(Environment.MachineName.ToLowerInvariant().Trim());

0 commit comments

Comments
 (0)