Browse Source

Added production publish profile.

Added auto-off function to migrate.
pull/29/head
Teknikode 7 years ago
parent
commit
fc96a2382c
  1. 10
      Teknik/Configuration/Config.cs
  2. 3
      Teknik/Migrations/Configuration.cs
  3. 24
      Teknik/Properties/PublishProfiles/Teknik Production.pubxml
  4. 1
      Teknik/Teknik.csproj

10
Teknik/Configuration/Config.cs

@ -123,16 +123,22 @@ namespace Teknik.Configuration @@ -123,16 +123,22 @@ namespace Teknik.Configuration
string path = AppDomain.CurrentDomain.GetData("DataDirectory").ToString();
if (!File.Exists(Path.Combine(path, "Config.json")))
{
Config.Save(Path.Combine(path, "Config.json"), config);
Save(Path.Combine(path, "Config.json"), config);
}
else
{
string configContents = File.ReadAllText(Path.Combine(path, "Config.json"));
config = Config.Deserialize(configContents);
config = Deserialize(configContents);
}
return config;
}
public static void Save(Config config)
{
string path = AppDomain.CurrentDomain.GetData("DataDirectory").ToString();
Save(Path.Combine(path, "Config.json"), config);
}
public static void Save(string path, Config config)
{
if (!Directory.Exists(Path.GetDirectoryName(path)))

3
Teknik/Migrations/Configuration.cs

@ -77,6 +77,9 @@ namespace Teknik.Migrations @@ -77,6 +77,9 @@ namespace Teknik.Migrations
if (config.DatabaseConfig.Migrate && !config.DevEnvironment)
{
config.DatabaseConfig.Migrate = false;
Config.Save(config);
// Convert legacy MySQL DB to new MS SQL DB
MysqlDatabase db = new MysqlDatabase(config.DatabaseConfig);
db.MysqlErrorEvent += Db_MysqlErrorEvent;

24
Teknik/Properties/PublishProfiles/Teknik Production.pubxml

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://www.teknik.io/</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<MSDeployServiceURL>teknik.io</MSDeployServiceURL>
<DeployIisAppPath>Teknik</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>Administrator</UserName>
<_SavePWD>True</_SavePWD>
</PropertyGroup>
</Project>

1
Teknik/Teknik.csproj

@ -465,6 +465,7 @@ @@ -465,6 +465,7 @@
<Content Include="Areas\Transparency\Views\Transparency\Index.cshtml" />
<Content Include="Areas\Help\Views\Help\RSS.cshtml" />
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
<None Include="Properties\PublishProfiles\Teknik Production.pubxml" />
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
<Content Include="Scripts\bootbox\bootbox.min.js" />
<Content Include="Scripts\bootstrap-select.js" />

Loading…
Cancel
Save