Browse Source

Added shortener config for shortener host.

Added another route for shortener host.
pull/29/head
Teknikode 6 years ago
parent
commit
2d331ddda4
  1. 10
      Teknik/Areas/Shortener/ShortenerAreaRegistration.cs
  2. 5
      Teknik/Configuration/Config.cs
  3. 17
      Teknik/Configuration/ShortenerConfig.cs
  4. 1
      Teknik/Teknik.csproj

10
Teknik/Areas/Shortener/ShortenerAreaRegistration.cs

@ -18,13 +18,21 @@ namespace Teknik.Areas.Shortener @@ -18,13 +18,21 @@ namespace Teknik.Areas.Shortener
{
Config config = Config.Load();
context.MapSubdomainRoute(
"Stream.Index", // Route name
"Shortener.Index", // Route name
new List<string>() { "dev", "shorten", "s" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Shortener", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.ShortenerController).Namespace }
);
context.MapSubdomainRoute(
"Shortener.View", // Route name
new List<string>() { "dev", "*" }, // Subdomains
new List<string>() { config.ShortenerConfig.ShortenerHost }, // domains
"", // URL with parameters
new { controller = "Shortener", action = "View" }, // Parameter defaults
new[] { typeof(Controllers.ShortenerController).Namespace }
);
}
}
}

5
Teknik/Configuration/Config.cs

@ -32,6 +32,7 @@ namespace Teknik.Configuration @@ -32,6 +32,7 @@ namespace Teknik.Configuration
private ApiConfig _ApiConfig;
private PodcastConfig _PodcastConfig;
private StreamConfig _StreamConfig;
private ShortenerConfig _ShortenerConfig;
private DatabaseConfig _DatabaseConfig;
public bool DevEnvironment { get { return _DevEnvironment; } set { _DevEnvironment = value; } }
@ -77,6 +78,9 @@ namespace Teknik.Configuration @@ -77,6 +78,9 @@ namespace Teknik.Configuration
// Stream Configuration
public StreamConfig StreamConfig { get { return _StreamConfig; } set { _StreamConfig = value; } }
// Shortener Configuration
public ShortenerConfig ShortenerConfig { get { return _ShortenerConfig; } set { _ShortenerConfig = value; } }
// Database Configuration
public DatabaseConfig DatabaseConfig { get { return _DatabaseConfig; } set { _DatabaseConfig = value; } }
@ -112,6 +116,7 @@ namespace Teknik.Configuration @@ -112,6 +116,7 @@ namespace Teknik.Configuration
ApiConfig = new ApiConfig();
PodcastConfig = new PodcastConfig();
StreamConfig = new StreamConfig();
ShortenerConfig = new ShortenerConfig();
DatabaseConfig = new DatabaseConfig();
}

17
Teknik/Configuration/ShortenerConfig.cs

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Configuration
{
public class ShortenerConfig
{
public string ShortenerHost { get; set; }
public ShortenerConfig()
{
ShortenerHost = string.Empty;
}
}
}

1
Teknik/Teknik.csproj

@ -228,6 +228,7 @@ @@ -228,6 +228,7 @@
<Compile Include="Areas\Upload\ViewModels\DeleteViewModel.cs" />
<Compile Include="Areas\Upload\ViewModels\DownloadViewModel.cs" />
<Compile Include="Areas\Upload\ViewModels\UploadViewModel.cs" />
<Compile Include="Configuration\ShortenerConfig.cs" />
<Compile Include="Configuration\StreamConfig.cs" />
<Compile Include="Configuration\ApiConfig.cs" />
<Compile Include="Configuration\DatabaseConfig.cs" />

Loading…
Cancel
Save