aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-01-01 14:30:20 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-01-01 14:30:20 +0200
commitb50b7ddb4c231810d17e0141bb77437718b10110 (patch)
treec16de7bd470703301740ccd2b0f39bed4304a6c1 /Software/Visual_Studio/Tango.Web
parent3415150ae12893d4f08d1afde512624755996095 (diff)
downloadTango-b50b7ddb4c231810d17e0141bb77437718b10110.tar.gz
Tango-b50b7ddb4c231810d17e0141bb77437718b10110.zip
Some more work on environments...
Diffstat (limited to 'Software/Visual_Studio/Tango.Web')
-rw-r--r--Software/Visual_Studio/Tango.Web/DeploymentSlot.cs5
-rw-r--r--Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs19
-rw-r--r--Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs20
-rw-r--r--Software/Visual_Studio/Tango.Web/Tango.Web.csproj7
-rw-r--r--Software/Visual_Studio/Tango.Web/WebSettings.cs27
5 files changed, 78 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs b/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs
index 7ec7ab82e..6531adb64 100644
--- a/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs
+++ b/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs
@@ -10,14 +10,19 @@ namespace Tango.Web
public enum DeploymentSlot
{
[Description("Development")]
+ [DeploymentSlotAddress("https://machineservice-dev.twine-srv.com")]
DEV,
[Description("Testing")]
+ [DeploymentSlotAddress("https://machineservice-test.twine-srv.com")]
TEST,
[Description("Process")]
+ [DeploymentSlotAddress("https://machineservice-process.twine-srv.com")]
PROCESS,
[Description("Staging")]
+ [DeploymentSlotAddress("https://machineservice-stage.twine-srv.com")]
STAGE,
[Description("Production")]
+ [DeploymentSlotAddress("https://machineservice.twine-srv.com")]
PROD
}
}
diff --git a/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs b/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs
new file mode 100644
index 000000000..c58c7a8b0
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Web
+{
+ [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
+ public class DeploymentSlotAddressAttribute : Attribute
+ {
+ public DeploymentSlotAddressAttribute(String address)
+ {
+ Address = address;
+ }
+
+ public String Address { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs b/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs
new file mode 100644
index 000000000..04e5ac300
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Web;
+
+public static class DeploymentSlotExtensions
+{
+ /// <summary>
+ /// Gets the deployment slot web address.
+ /// </summary>
+ /// <param name="slot">The slot.</param>
+ /// <returns></returns>
+ public static String ToAddress(this DeploymentSlot slot)
+ {
+ return slot.GetAttribute<DeploymentSlotAddressAttribute>().Address;
+ }
+}
+
diff --git a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
index d9a1d1dd1..d0d30482d 100644
--- a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
+++ b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
@@ -246,6 +246,8 @@
<Compile Include="ActiveDirectory\ActiveDirectoryManager.cs" />
<Compile Include="Authentication\TokensManager.cs" />
<Compile Include="DeploymentSlot.cs" />
+ <Compile Include="DeploymentSlotAddressAttribute.cs" />
+ <Compile Include="ExtensionMethods\DeploymentSlotExtensions.cs" />
<Compile Include="Logging\AzureCloudLogger.cs" />
<Compile Include="SQLServer\SQLServerManager.cs" />
<Compile Include="Storage\ExtensionMethods.cs" />
@@ -260,6 +262,7 @@
<Compile Include="Controllers\ProtoController.cs" />
<Compile Include="SMO\SmoManager.cs" />
<Compile Include="WebApiException.cs" />
+ <Compile Include="WebSettings.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -282,6 +285,10 @@
<Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project>
<Name>Tango.PMR</Name>
</ProjectReference>
+ <ProjectReference Include="..\Tango.Settings\Tango.Settings.csproj">
+ <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project>
+ <Name>Tango.Settings</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
diff --git a/Software/Visual_Studio/Tango.Web/WebSettings.cs b/Software/Visual_Studio/Tango.Web/WebSettings.cs
new file mode 100644
index 000000000..fdc92810c
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/WebSettings.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Settings;
+using System.Reflection;
+
+namespace Tango.Web
+{
+ public class WebSettings : SettingsBase
+ {
+ /// <summary>
+ /// Gets or sets the deployment slot.
+ /// </summary>
+ public DeploymentSlot DeploymentSlot { get; set; }
+
+ /// <summary>
+ /// Gets the machine service address.
+ /// </summary>
+ /// <returns></returns>
+ public String GetMachineServiceAddress()
+ {
+ return DeploymentSlot.GetAttribute<DeploymentSlotAddressAttribute>().Address;
+ }
+ }
+}