-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/100-fix-github-powershell-scripts
- Loading branch information
Showing
20 changed files
with
1,358 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,7 +365,5 @@ FodyWeavers.xsd | |
# | ||
Deploy/ | ||
|
||
App.*.config | ||
WtfIsThis.cs | ||
.idea/ | ||
.AssemblyAttributes |
60 changes: 60 additions & 0 deletions
60
Assemblies/MFDLabs.Configuration/Extensions/SettingExtensions.cs
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,60 @@ | ||
using System; | ||
using MFDLabs.Text.Extensions; | ||
using MFDLabs.Reflection.Extensions; | ||
|
||
#nullable enable | ||
|
||
namespace MFDLabs.Configuration.Extensions | ||
{ | ||
public static class SettingExtensions | ||
{ | ||
// There's a special kind of var here that does like this: | ||
// ${{ env.VAR_NAME }}, which is a special kind of var that will be replaced with the value of the environment variable VAR_NAME. | ||
// This is useful when you want to pass the value of an environment variable to a command. | ||
// We have to parse this out, and replace it with the value of the environment variable. | ||
public static TResult? FromEnvironmentExpression<TResult>(this object setting) | ||
{ | ||
if (setting is not string str) return default; | ||
if (str.IsNullOrEmpty()) return str.To<TResult>(); | ||
|
||
// Trim the input | ||
str = str.Trim(); | ||
|
||
// Remove the spaces from the input. | ||
str = str.Replace(" ", ""); | ||
|
||
// Check if the input contains the special var | ||
if (!str.StartsWith("${{")) return str.To<TResult>(); | ||
|
||
// Split the input into parts | ||
var parts = str.Split(new[] { "${{" }, StringSplitOptions.None); | ||
|
||
// We now need to get the part in the middle of ${{ }} | ||
var otherPart = parts[1]; | ||
|
||
// Split the middle part into parts | ||
var middleParts = otherPart.Split(new[] { "}}" }, StringSplitOptions.None); | ||
|
||
// Get the name of the environment variable | ||
var middlePart = middleParts[0]; | ||
|
||
// Check if the middle part starts with env. | ||
if (!middlePart.ToLower().StartsWith("env.")) return str.To<TResult>(); | ||
|
||
// Get the env var name | ||
var envVarName = middlePart.Remove(0, 4); | ||
|
||
// Check if the env var is empty | ||
if (envVarName.IsNullOrWhiteSpace()) return str.To<TResult>(); | ||
|
||
// Get the env var value | ||
var env = Environment.GetEnvironmentVariable(envVarName); | ||
|
||
// Check if the env var value is empty, if so, return the original string | ||
if (env.IsNullOrEmpty()) return str.To<TResult>(); | ||
|
||
// Replace the env var value with the env var name | ||
return env.To<TResult>(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,86 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | ||
<section name="MFDLabs.Grid.AutoDeployer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="MFDLabs.Networking.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="MFDLabs.Diagnostics.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<applicationSettings> | ||
<MFDLabs.Grid.AutoDeployer.Properties.Settings> | ||
<setting name="GithubEnterpriseUrl" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="VersioningRegistryVersionKeyName" serializeAs="String"> | ||
<value>AppVersion</value> | ||
</setting> | ||
<setting name="CreateDeploymentPathIfNotExists" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="GithubToken" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="VersioningRegistrySubKey" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DeploymentPath" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="GithubAccountOrOrganizationName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="GithubRepositoryName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DeploymentPrimaryExecutableName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="PollingInterval" serializeAs="String"> | ||
<value>00:00:00</value> | ||
</setting> | ||
<setting name="EnvironmentLogLevel" serializeAs="String"> | ||
<value>Verbose</value> | ||
</setting> | ||
<setting name="DeploymentAppName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="SkippedVersionInvalidationInterval" serializeAs="String"> | ||
<value>00:05:00</value> | ||
</setting> | ||
</MFDLabs.Grid.AutoDeployer.Properties.Settings> | ||
<MFDLabs.Networking.Properties.Settings> | ||
<setting name="LocalIPOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</MFDLabs.Networking.Properties.Settings> | ||
<MFDLabs.Diagnostics.Properties.Settings> | ||
<setting name="MachineHostOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="MachineIDOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</MFDLabs.Diagnostics.Properties.Settings> | ||
</applicationSettings> | ||
<runtime> | ||
<legacyUnhandledExceptionPolicy enabled="1" /> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | ||
</dependentAssembly>> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<configSections> | ||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | ||
<section name="MFDLabs.Grid.AutoDeployer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="MFDLabs.Networking.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
<section name="MFDLabs.Diagnostics.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<applicationSettings> | ||
<MFDLabs.Grid.AutoDeployer.Properties.Settings> | ||
<setting name="GithubEnterpriseUrl" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="VersioningRegistryVersionKeyName" serializeAs="String"> | ||
<value>AppVersion</value> | ||
</setting> | ||
<setting name="CreateDeploymentPathIfNotExists" serializeAs="String"> | ||
<value>True</value> | ||
</setting> | ||
<setting name="GithubToken" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="VersioningRegistrySubKey" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DeploymentPath" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="GithubAccountOrOrganizationName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="GithubRepositoryName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="DeploymentPrimaryExecutableName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="PollingInterval" serializeAs="String"> | ||
<value>00:00:00</value> | ||
</setting> | ||
<setting name="EnvironmentLogLevel" serializeAs="String"> | ||
<value>Verbose</value> | ||
</setting> | ||
<setting name="DeploymentAppName" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="SkippedVersionInvalidationInterval" serializeAs="String"> | ||
<value>00:05:00</value> | ||
</setting> | ||
</MFDLabs.Grid.AutoDeployer.Properties.Settings> | ||
<MFDLabs.Networking.Properties.Settings> | ||
<setting name="LocalIPOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</MFDLabs.Networking.Properties.Settings> | ||
<MFDLabs.Diagnostics.Properties.Settings> | ||
<setting name="MachineHostOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
<setting name="MachineIDOverride" serializeAs="String"> | ||
<value /> | ||
</setting> | ||
</MFDLabs.Diagnostics.Properties.Settings> | ||
</applicationSettings> | ||
<runtime> | ||
<legacyUnhandledExceptionPolicy enabled="1" /> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
Oops, something went wrong.