Webserver relevant configuration values are copied on every wpx command from file ConfigCli.json to file ConfigServer.json.
WorkplaceX.org
Boost your Business App
All configuration values are stored in the file ConfigCli.json. It contains for example different configurations for DEV, TEST and PROD environment.
To switch for example to PROD environment configuration call:
wpx env name=PROD
Following example contains a configuration for DEV and one for PROD environment.
// File: ConfigCli.json
{
"EnvironmentName": "DEV",
"EnvironmentList": [
{
"EnvironmentName": "DEV",
"IsUseDeveloperExceptionPage": false,
"IsRedirectHttps": false,
"IsRedirectWww": false,
"ConnectionStringFramework": "Data Source=localhost; Initial Catalog=ApplicationDemo; Integrated Security=True;",
"ConnectionStringApplication": "Data Source=localhost; Initial Catalog=ApplicationDemo; Integrated Security=True;",
"DeployAzureGitUrl": null
},
{
"EnvironmentName": "PROD",
"IsUseDeveloperExceptionPage": false,
"IsRedirectHttps": true,
"IsRedirectWww": true,
"ConnectionStringFramework": "Data Source=localhost; Initial Catalog=ApplicationDemo; Integrated Security=True;",
"ConnectionStringApplication": "Data Source=localhost; Initial Catalog=ApplicationDemo; Integrated Security=True;",
"DeployAzureGitUrl": null
}
],
"WebsiteList": [
{
"FolderNameAngular": "Application.Website/",
"DomainNameList": [
{
"EnvironmentName": "DEV",
"DomainName": "localhost",
"AppTypeName": "Application.Demo.AppMain, Application",
"IsRedirectHttps": false,
"BingMapKey": null,
"GoogleAnalyticsId": null
},
{
"EnvironmentName": "PROD",
"DomainName": "demo.workplacex.org",
"AppTypeName": "Application.Demo.AppMain, Application",
"IsRedirectHttps": false,
"BingMapKey": null,
"GoogleAnalyticsId": null
}
]
}
],
"ExternalGitList": []
}
It's possible to define programmatically a default ConfigCli.json configuration. If there is no ConfigCli.json file it is created on any wpx command.
// File: Application.Cli/App/AppCliMain.cs
namespace Application.Cli.Doc
{
using Application.Doc;
using Framework.Cli;
using Framework.Cli.Config;
using System.Collections.Generic;
using System.Runtime.InteropServices;
/// <summary>
/// Command line interface application.
/// </summary>
public class AppCliMain : AppCli
{
...
/// <summary>
/// Set default values if file ConfigCli.json does not exist.
/// </summary>
protected override void InitConfigCli(ConfigCli configCli)
{
string appTypeName = UtilCli.AppTypeName(typeof(AppMain));
configCli.WebsiteList.Add(new ConfigCliWebsite()
{
DomainNameList = new List<ConfigCliWebsiteDomain>(new ConfigCliWebsiteDomain[] { new ConfigCliWebsiteDomain { EnvironmentName = "DEV", DomainName = "localhost", AppTypeName = appTypeName } }),
FolderNameAngular = "Application.Website/",
});
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Default ConnectionString (Windows)
configCli.EnvironmentGet().ConnectionStringApplication = "Data Source=localhost; Initial Catalog=ApplicationDoc; Integrated Security=True;";
configCli.EnvironmentGet().ConnectionStringFramework = "Data Source=localhost; Initial Catalog=ApplicationDoc; Integrated Security=True;";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
// Default ConnectionString (Linux)
configCli.EnvironmentGet().ConnectionStringApplication = "Data Source=localhost; Initial Catalog=ApplicationDoc; User Id=SA; Password=MyPassword;";
configCli.EnvironmentGet().ConnectionStringFramework = "Data Source=localhost; Initial Catalog=ApplicationDoc; User Id=SA; Password=MyPassword;";
}
}
...
}
}
Provide feedback to this page if you have any question regarding content or something should get updated.