External config

This commit is contained in:
pavelbannov 2019-06-21 11:03:42 +03:00
parent b8142ca296
commit 48217aedd8
11 changed files with 95 additions and 420 deletions

69
config/appsettings.json Normal file
View File

@ -0,0 +1,69 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"core": {
"base-domain": "",
"machinekey": "1123askdasjklasbnd",
"notify": {
"postman": "log"
},
"payment": {
"delay": "10",
"partners": "https://partners.teamlab.info/api",
"region": "test",
"test": true
}
},
"license": {
"file": {
"path": ""
}
},
"mail": {
"certificate-permit": false,
"daemon-email": "mail-daemon@onlyoffice.com",
"server-mailbox-limit-per-user": 2
},
"messaging": {
"enabled": "enabled"
},
"version": {
"release": {
"date": "",
"sign": ""
}
},
"web": {
"api": "api/2.0",
"alias": {
"min": ""
},
"images": "images",
"hide-settings": "Monitoring,LdapSettings,DocService,MailService,PublicPortal,ProxyHttpContent,SpamSubscription,FullTextSearch",
"hub": {
"url": "",
"internal": ""
}
},
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none",
"providerName": "MySql.Data.MySqlClient"
}
},
"DbProviderFactories": {
"mysql": {
"name": "MySQL Data Provider",
"invariant": "MySql.Data.MySqlClient",
"description": ".Net Framework Data Provider for MySQL",
"type": "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"
}
}
}

View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System.IO;
namespace ASC.Web.Api namespace ASC.Web.Api
{ {
@ -18,8 +19,19 @@ namespace ASC.Web.Api
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
}) })
.ConfigureAppConfiguration((hostingContext, config) => { .ConfigureAppConfiguration((hostingContext, config) => {
config.AddJsonFile("autofac.json"); var buided = config.Build();
config.AddJsonFile("storage.json"); var path = buided["pathToConf"];
if (!Path.IsPathRooted(path))
{
path = Path.GetFullPath(Path.Combine(hostingContext.HostingEnvironment.ContentRootPath, path));
}
config.SetBasePath(path);
config
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddJsonFile("autofac.api.json")
.AddJsonFile("storage.json");
}); });
} }
} }

View File

@ -1,69 +1,3 @@
{ {
"Logging": { "pathToConf": "..\\..\\config"
"LogLevel": { }
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"core": {
"base-domain": "",
"machinekey": "1123askdasjklasbnd",
"notify": {
"postman": "log"
},
"payment": {
"delay": "10",
"partners": "https://partners.teamlab.info/api",
"region": "test",
"test": true
}
},
"license": {
"file": {
"path": ""
}
},
"mail": {
"certificate-permit": false,
"daemon-email": "mail-daemon@onlyoffice.com",
"server-mailbox-limit-per-user": 2
},
"messaging": {
"enabled": "true"
},
"version": {
"release": {
"date": "",
"sign": ""
}
},
"web": {
"api": "api/2.0",
"alias": {
"min": ""
},
"images": "images",
"hide-settings": "Monitoring,LdapSettings,DocService,MailService,PublicPortal,ProxyHttpContent,SpamSubscription,FullTextSearch",
"hub": {
"url": "",
"internal": ""
}
},
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none",
"providerName": "MySql.Data.MySqlClient"
}
},
"DbProviderFactories": {
"mysql": {
"name": "MySQL Data Provider",
"invariant": "MySql.Data.MySqlClient",
"description": ".Net Framework Data Provider for MySQL",
"type": "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"
}
}
}

View File

@ -1,3 +1,4 @@
using System.IO;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -18,7 +19,15 @@ namespace ASC.Web.Studio
w.UseStartup<Startup>(); w.UseStartup<Startup>();
}) })
.ConfigureAppConfiguration((hostingContext, config) => { .ConfigureAppConfiguration((hostingContext, config) => {
var buided = config.Build();
var path = buided["pathToConf"];
if (!Path.IsPathRooted(path)) {
path = Path.GetFullPath(Path.Combine(hostingContext.HostingEnvironment.ContentRootPath, path));
}
config.SetBasePath(path);
config config
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddJsonFile("autofac.json") .AddJsonFile("autofac.json")
.AddJsonFile("storage.json"); .AddJsonFile("storage.json");
}); });

View File

@ -1,20 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=172.18.0.2;Port=3306;Database=onlyoffice;User ID=onlyoffice_user;Password=onlyoffice_pass;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none",
"providerName": "MySql.Data.MySqlClient"
}
},
"core": {
"base-domain": "localhost",
"machinekey": "1VVAepxpW8f7"
}
}

View File

@ -1,69 +1,3 @@
{ {
"Logging": { "pathToConf": "..\\..\\config"
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"core": {
"base-domain": "",
"machinekey": "1123askdasjklasbnd",
"notify": {
"postman": "log"
},
"payment": {
"delay": "10",
"partners": "https://partners.teamlab.info/api",
"region": "test",
"test": true
}
},
"license": {
"file": {
"path": ""
}
},
"mail": {
"certificate-permit": false,
"daemon-email": "mail-daemon@onlyoffice.com",
"server-mailbox-limit-per-user": 2
},
"messaging": {
"enabled": "enabled"
},
"version": {
"release": {
"date": "",
"sign": ""
}
},
"web": {
"api": "api/2.0",
"alias": {
"min": ""
},
"images": "images",
"hide-settings": "Monitoring,LdapSettings,DocService,MailService,PublicPortal,ProxyHttpContent,SpamSubscription,FullTextSearch",
"hub": {
"url": "",
"internal": ""
}
},
"ConnectionStrings": {
"default": {
"name": "default",
"connectionString": "Server=localhost;Database=onlyoffice;User ID=dev;Password=dev;Pooling=true;Character Set=utf8;AutoEnlist=false;SSL Mode=none",
"providerName": "MySql.Data.MySqlClient"
}
},
"DbProviderFactories": {
"mysql": {
"name": "MySQL Data Provider",
"invariant": "MySql.Data.MySqlClient",
"description": ".Net Framework Data Provider for MySQL",
"type": "MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"
}
}
} }

View File

@ -1,263 +0,0 @@
{
"storage": {
"appender": [
{
"name": "generic",
"append": "~/"
}
],
"handler": [
{
"name": "disc",
"type": "ASC.Data.Storage.DiscStorage.DiscDataStore, ASC.Data.Storage",
"property": [
{
"name": "$STORAGE_ROOT",
"value": "..\\Data\\"
}
]
}
],
"module": [
{
"name": "forum",
"data": "853B6EB9-73EE-438d-9B09-8FFEEDF36234",
"type": "disc",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Forum\\Data\\attachments",
"virtualpath": "~/products/community/modules/forum/data/attachments",
"expires": "0:10:0"
},
{
"name": "bookmarking",
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Bookmarking\\Data\\images",
"virtualpath": "~/products/community/modules/bookmarking/data/images"
},
{
"name": "wiki",
"data": "742CF945-CBBC-4a57-82D6-1600A12CF8CA",
"type": "disc",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Wiki\\Data\\files",
"virtualpath": "~/products/community/modules/wiki/data/files",
"expires": "0:10:0",
"domain": [
{
"name": "temp",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Wiki\\Data\\filestemp",
"virtualpath": "~/products/community/modules/wiki/data/filestemp"
}
]
},
{
"name": "files",
"data": "e67be73d-f9ae-4ce1-8fec-1880cb518cb4",
"type": "disc",
"path": "$STORAGE_ROOT\\Products\\Files",
"expires": "0:16:0",
"domain": [
{
"name": "files_temp",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Files\\{0}\\temp",
"virtualpath": "~/products/community/modules/wiki/data/filestemp",
"expires": "0:10:0"
}
]
},
{
"name": "files_template",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "Products\\Files\\DocStore",
"virtualpath": "~/products/files/docstore",
"appendTenantId": false,
"public": true,
"disableMigrate": true
},
{
"name": "crm",
"data": "6743007C-6F95-4d20-8C88-A8601CE5E76D",
"type": "disc",
"path": "$STORAGE_ROOT\\Products\\CRM\\Data",
"virtualpath": "~/products/crm/data",
"domain": [
{
"name": "temp",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\CRM\\Data\\{0}\\temp"
},
{
"name": "mail_messages",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\CRM\\Data\\{0}\\mail_messages"
},
{
"name": "voip",
"visible": true,
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\CRM\\Data\\{0}\\voip",
"virtualpath": "~/products/crm/data/{0}/voip",
"public": true
}
]
},
{
"name": "crm_template",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "Products\\CRM\\DocStore",
"disableMigrate": true
},
{
"name": "fckuploaders",
"count": false,
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\htmleditorfiles",
"virtualpath": "~/data/shared/htmleditorfiles",
"domain": [
{
"name": "mail",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\addons\\mail\\Data\\htmleditorfiles",
"virtualpath": "~/addons/mail/data/htmleditorfiles"
},
{
"name": "forum",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Forum\\Data\\htmleditorfiles",
"virtualpath": "~/products/community/modules/forum/data/htmleditorfiles"
},
{
"name": "news",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\News\\Data\\htmleditorfiles",
"virtualpath": "~/products/community/modules/news/data/htmleditorfiles"
},
{
"name": "news_comments",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\News\\Data\\fckcomments",
"virtualpath": "~/products/community/modules/news/data/fckcomments"
},
{
"name": "blogs",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Blogs\\Data\\htmleditorfiles",
"virtualpath": "~/products/community/modules/blogs/data/htmleditorfiles"
},
{
"name": "blogs_comments",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Blogs\\Data\\fckcomments",
"virtualpath": "~/products/community/modules/blogs/data/fckcomments"
},
{
"name": "bookmarking_comments",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Bookmarking\\data\\fckcomments",
"virtualpath": "~/products/community/modules/bookmarking/data/fckcomments"
},
{
"name": "wiki_comments",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Community\\Modules\\Wiki\\Data\\fckcomments",
"virtualpath": "~/products/community/modules/wiki/data/fckcomments"
},
{
"name": "projects_comments",
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Products\\Projects\\Data\\fckcomments",
"virtualpath": "~/products/projects/data/fckcomments"
}
]
},
{
"name": "talk",
"data": "BF88953E-3C43-4850-A3FB-B1E43AD53A3E",
"type": "disc",
"path": "$STORAGE_ROOT\\addons\\talk\\Data",
"virtualpath": "~/addons/talk/data"
},
{
"name": "certs",
"visible": "false",
"type": "disc",
"path": "$STORAGE_ROOT\\certs\\",
"appendTenantId": false
},
{
"name": "mailaggregator",
"data": "666ceac1-4532-4f8c-9cba-8f510eca2fd1",
"type": "disc",
"path": "$STORAGE_ROOT\\addons\\mail\\Data\\aggregator",
"virtualpath": "~/addons/mail/data/aggregator"
},
{
"name": "logo",
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\{0}\\logo",
"virtualpath": "~/studio/{0}/logo",
"public": true
},
{
"name": "whitelabel",
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\{0}\\CoBranding",
"virtualpath": "~/studio/{0}/cobranding",
"public": true
},
{
"name": "backup",
"visible": false,
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\{0}\\backup",
"virtualpath": "~/studio/{0}/backup",
"expires": "0:10:0"
},
{
"name": "customnavigation",
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\{0}\\customnavigation",
"virtualpath": "~/studio/{0}/customnavigation"
},
{
"name": "userPhotos",
"count": false,
"data": "00000000-0000-0000-0000-000000000000",
"type": "disc",
"path": "$STORAGE_ROOT\\Studio\\{0}\\userphotos",
"virtualpath": "~/studio/{0}/userphotos",
"domain": [
{
"name": "temp",
"visible": false,
"data": "00000000-0000-0000-0000-000000000000",
"path": "$STORAGE_ROOT\\Studio\\{0}\\userphotos\\temp",
"virtualpath": "~/studio/{0}/userphotos/temp"
}
]
},
{
"name": "static_partnerdata",
"type": "disc",
"path": "App_Data\\static\\partnerdata",
"acl": "Read",
"virtualpath": "~/App_Data/static/partnerdata",
"appendTenantId": false,
"public": true,
"disableMigrate": true
}
]
}
}