mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -3,4 +3,7 @@
|
|||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="AzureSDK" value="C:\Program Files\Windows Azure SDK\v1.3\"/>
|
<add key="AzureSDK" value="C:\Program Files\Windows Azure SDK\v1.3\"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
using System.Configuration;
|
using System.ComponentModel;
|
||||||
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.WindowsAzure;
|
||||||
using Microsoft.WindowsAzure.StorageClient;
|
using Microsoft.WindowsAzure.StorageClient;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
@@ -35,7 +37,11 @@ namespace Orchard.Azure.Tests {
|
|||||||
_dsService.Close();
|
_dsService.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void DeleteAllBlobs(CloudBlobContainer container) {
|
protected void DeleteAllBlobs(string containerName, CloudStorageAccount account)
|
||||||
|
{
|
||||||
|
var blobClient = account.CreateCloudBlobClient();
|
||||||
|
var container = blobClient.GetContainerReference(containerName);
|
||||||
|
|
||||||
foreach ( var blob in container.ListBlobs() ) {
|
foreach ( var blob in container.ListBlobs() ) {
|
||||||
if ( blob is CloudBlob ) {
|
if ( blob is CloudBlob ) {
|
||||||
( (CloudBlob)blob ).DeleteIfExists();
|
( (CloudBlob)blob ).DeleteIfExists();
|
||||||
|
@@ -8,36 +8,35 @@ namespace Orchard.Azure.Tests.Environment.Configuration {
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AzureShellSettingsManagerTests : AzureVirtualEnvironmentTest {
|
public class AzureShellSettingsManagerTests : AzureVirtualEnvironmentTest {
|
||||||
|
|
||||||
protected IShellSettingsManager Loader;
|
protected CloudStorageAccount DevAccount;
|
||||||
|
protected IShellSettingsManager ShellSettingsManager;
|
||||||
|
|
||||||
protected override void OnInit() {
|
protected override void OnInit() {
|
||||||
CloudStorageAccount devAccount;
|
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out DevAccount);
|
||||||
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out devAccount);
|
ShellSettingsManager = new AzureShellSettingsManager(DevAccount, new Moq.Mock<IShellSettingsManagerEventHandler>().Object);
|
||||||
|
|
||||||
Loader = new AzureShellSettingsManager(devAccount, new Moq.Mock<IShellSettingsManagerEventHandler>().Object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() {
|
public void Setup() {
|
||||||
// ensure default container is empty before running any test
|
// ensure default container is empty before running any test
|
||||||
DeleteAllBlobs( ((AzureShellSettingsManager)Loader).Container);
|
DeleteAllBlobs(AzureShellSettingsManager.ContainerName, DevAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void TearDown() {
|
public void TearDown() {
|
||||||
// ensure default container is empty after running tests
|
// ensure default container is empty after running tests
|
||||||
DeleteAllBlobs(( (AzureShellSettingsManager)Loader ).Container);
|
DeleteAllBlobs(AzureShellSettingsManager.ContainerName, DevAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void SingleSettingsFileShouldComeBackAsExpected() {
|
public void SingleSettingsFileShouldComeBackAsExpected() {
|
||||||
|
|
||||||
Loader.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLite", DataConnectionString = "something else" });
|
ShellSettingsManager.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLCe", DataConnectionString = "something else" });
|
||||||
|
|
||||||
var settings = Loader.LoadSettings().Single();
|
var settings = ShellSettingsManager.LoadSettings().Single();
|
||||||
Assert.That(settings, Is.Not.Null);
|
Assert.That(settings, Is.Not.Null);
|
||||||
Assert.That(settings.Name, Is.EqualTo("Default"));
|
Assert.That(settings.Name, Is.EqualTo("Default"));
|
||||||
Assert.That(settings.DataProvider, Is.EqualTo("SQLite"));
|
Assert.That(settings.DataProvider, Is.EqualTo("SQLCe"));
|
||||||
Assert.That(settings.DataConnectionString, Is.EqualTo("something else"));
|
Assert.That(settings.DataConnectionString, Is.EqualTo("something else"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,37 +44,37 @@ namespace Orchard.Azure.Tests.Environment.Configuration {
|
|||||||
[Test]
|
[Test]
|
||||||
public void MultipleFilesCanBeDetected() {
|
public void MultipleFilesCanBeDetected() {
|
||||||
|
|
||||||
Loader.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLite", DataConnectionString = "something else" });
|
ShellSettingsManager.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLCe", DataConnectionString = "something else" });
|
||||||
Loader.SaveSettings(new ShellSettings { Name = "Another", DataProvider = "SQLite2", DataConnectionString = "something else2" });
|
ShellSettingsManager.SaveSettings(new ShellSettings { Name = "Another", DataProvider = "SQLCe2", DataConnectionString = "something else2" });
|
||||||
|
|
||||||
var settings = Loader.LoadSettings();
|
var settings = ShellSettingsManager.LoadSettings();
|
||||||
Assert.That(settings.Count(), Is.EqualTo(2));
|
Assert.That(settings.Count(), Is.EqualTo(2));
|
||||||
|
|
||||||
var def = settings.Single(x => x.Name == "Default");
|
var def = settings.Single(x => x.Name == "Default");
|
||||||
Assert.That(def.Name, Is.EqualTo("Default"));
|
Assert.That(def.Name, Is.EqualTo("Default"));
|
||||||
Assert.That(def.DataProvider, Is.EqualTo("SQLite"));
|
Assert.That(def.DataProvider, Is.EqualTo("SQLCe"));
|
||||||
Assert.That(def.DataConnectionString, Is.EqualTo("something else"));
|
Assert.That(def.DataConnectionString, Is.EqualTo("something else"));
|
||||||
|
|
||||||
var alt = settings.Single(x => x.Name == "Another");
|
var alt = settings.Single(x => x.Name == "Another");
|
||||||
Assert.That(alt.Name, Is.EqualTo("Another"));
|
Assert.That(alt.Name, Is.EqualTo("Another"));
|
||||||
Assert.That(alt.DataProvider, Is.EqualTo("SQLite2"));
|
Assert.That(alt.DataProvider, Is.EqualTo("SQLCe2"));
|
||||||
Assert.That(alt.DataConnectionString, Is.EqualTo("something else2"));
|
Assert.That(alt.DataConnectionString, Is.EqualTo("something else2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void NewSettingsCanBeStored() {
|
public void NewSettingsCanBeStored() {
|
||||||
Loader.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLite", DataConnectionString = "something else" });
|
ShellSettingsManager.SaveSettings(new ShellSettings { Name = "Default", DataProvider = "SQLite", DataConnectionString = "something else" });
|
||||||
|
|
||||||
var foo = new ShellSettings { Name = "Foo", DataProvider = "Bar", DataConnectionString = "Quux" };
|
var foo = new ShellSettings { Name = "Foo", DataProvider = "Bar", DataConnectionString = "Quux" };
|
||||||
|
|
||||||
Assert.That(Loader.LoadSettings().Count(), Is.EqualTo(1));
|
Assert.That(ShellSettingsManager.LoadSettings().Count(), Is.EqualTo(1));
|
||||||
Loader.SaveSettings(foo);
|
ShellSettingsManager.SaveSettings(foo);
|
||||||
Assert.That(Loader.LoadSettings().Count(), Is.EqualTo(2));
|
Assert.That(ShellSettingsManager.LoadSettings().Count(), Is.EqualTo(2));
|
||||||
|
|
||||||
var text = ( (AzureShellSettingsManager)Loader ).Container.GetBlockBlobReference("Foo/Settings.txt").DownloadText();
|
foo = ShellSettingsManager.LoadSettings().Where(s => s.Name == "Foo").Single();
|
||||||
Assert.That(text, Is.StringContaining("Foo"));
|
Assert.That(foo.Name, Is.StringContaining("Foo"));
|
||||||
Assert.That(text, Is.StringContaining("Bar"));
|
Assert.That(foo.DataProvider, Is.StringContaining("Bar"));
|
||||||
Assert.That(text, Is.StringContaining("Quux"));
|
Assert.That(foo.DataConnectionString, Is.StringContaining("Quux"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,19 +10,19 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest {
|
public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest {
|
||||||
|
|
||||||
|
CloudStorageAccount DevAccount;
|
||||||
private AzureBlobStorageProvider _azureBlobStorageProvider;
|
private AzureBlobStorageProvider _azureBlobStorageProvider;
|
||||||
|
|
||||||
protected override void OnInit() {
|
protected override void OnInit() {
|
||||||
CloudStorageAccount devAccount;
|
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out DevAccount);
|
||||||
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out devAccount);
|
|
||||||
|
|
||||||
_azureBlobStorageProvider = new AzureBlobStorageProvider(new ShellSettings { Name = "default" }, devAccount);
|
_azureBlobStorageProvider = new AzureBlobStorageProvider(new ShellSettings { Name = "default" }, DevAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() {
|
public void Setup() {
|
||||||
// ensure default container is empty before running any test
|
// ensure default container is empty before running any test
|
||||||
DeleteAllBlobs(_azureBlobStorageProvider.Container);
|
DeleteAllBlobs(_azureBlobStorageProvider.Container.Name, DevAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@@ -28,8 +28,8 @@ namespace Orchard.Azure {
|
|||||||
// Setup the connection to custom storage accountm, e.g. Development Storage
|
// Setup the connection to custom storage accountm, e.g. Development Storage
|
||||||
_storageAccount = storageAccount;
|
_storageAccount = storageAccount;
|
||||||
ContainerName = containerName;
|
ContainerName = containerName;
|
||||||
_root = String.IsNullOrEmpty(root) || root == "/" ? String.Empty : root + "/";
|
_root = String.IsNullOrEmpty(root) ? "": root + "/";
|
||||||
_absoluteRoot = _storageAccount.BlobEndpoint.AbsoluteUri + containerName + "/" + root + "/";
|
_absoluteRoot = _storageAccount.BlobEndpoint.AbsoluteUri + "/" + containerName + "/" + root;
|
||||||
|
|
||||||
using ( new HttpContextWeaver() ) {
|
using ( new HttpContextWeaver() ) {
|
||||||
|
|
||||||
@@ -40,12 +40,11 @@ namespace Orchard.Azure {
|
|||||||
|
|
||||||
Container.CreateIfNotExist();
|
Container.CreateIfNotExist();
|
||||||
|
|
||||||
if (isPrivate) {
|
Container.SetPermissions(isPrivate
|
||||||
Container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Off });
|
? new BlobContainerPermissions
|
||||||
}
|
{PublicAccess = BlobContainerPublicAccessType.Off}
|
||||||
else {
|
: new BlobContainerPermissions
|
||||||
Container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container });
|
{PublicAccess = BlobContainerPublicAccessType.Container});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -107,7 +106,7 @@ namespace Orchard.Azure {
|
|||||||
|
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
|
|
||||||
string prefix = String.Concat(Combine(Container.Name, _root), path);
|
string prefix = Combine(Combine(Container.Name, _root), path);
|
||||||
|
|
||||||
if ( !prefix.EndsWith("/") )
|
if ( !prefix.EndsWith("/") )
|
||||||
prefix += "/";
|
prefix += "/";
|
||||||
@@ -128,7 +127,16 @@ namespace Orchard.Azure {
|
|||||||
|
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
using ( new HttpContextWeaver() ) {
|
using ( new HttpContextWeaver() ) {
|
||||||
if ( !Container.DirectoryExists(String.Concat(_root, path)) ) {
|
|
||||||
|
// return root folders
|
||||||
|
if (String.Concat(_root, path) == String.Empty) {
|
||||||
|
return Container.ListBlobs()
|
||||||
|
.OfType<CloudBlobDirectory>()
|
||||||
|
.Select<CloudBlobDirectory, IStorageFolder>(d => new AzureBlobFolderStorage(d, _absoluteRoot))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Container.DirectoryExists(String.Concat(_root, path)) ) {
|
||||||
try {
|
try {
|
||||||
CreateFolder(String.Concat(_root, path));
|
CreateFolder(String.Concat(_root, path));
|
||||||
}
|
}
|
||||||
@@ -146,14 +154,12 @@ namespace Orchard.Azure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TryCreateFolder(string path)
|
public void TryCreateFolder(string path) {
|
||||||
{
|
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
CreateFile(Combine(path, FolderEntry));
|
CreateFile(Combine(path, FolderEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateFolder(string path)
|
public void CreateFolder(string path) {
|
||||||
{
|
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
using (new HttpContextWeaver()) {
|
using (new HttpContextWeaver()) {
|
||||||
Container.EnsureDirectoryDoesNotExist(String.Concat(_root, path));
|
Container.EnsureDirectoryDoesNotExist(String.Concat(_root, path));
|
||||||
|
@@ -2,10 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Microsoft.WindowsAzure;
|
using Microsoft.WindowsAzure;
|
||||||
using Microsoft.WindowsAzure.ServiceRuntime;
|
using Microsoft.WindowsAzure.ServiceRuntime;
|
||||||
using Microsoft.WindowsAzure.StorageClient;
|
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
|
||||||
@@ -13,97 +11,68 @@ namespace Orchard.Azure.Environment.Configuration {
|
|||||||
|
|
||||||
public class AzureShellSettingsManager : IShellSettingsManager {
|
public class AzureShellSettingsManager : IShellSettingsManager {
|
||||||
public const string ContainerName = "sites"; // container names must be lower cased
|
public const string ContainerName = "sites"; // container names must be lower cased
|
||||||
|
public const string SettingsFilename = "Settings.txt";
|
||||||
|
|
||||||
private readonly IShellSettingsManagerEventHandler _events;
|
private readonly IShellSettingsManagerEventHandler _events;
|
||||||
|
private readonly AzureFileSystem _fileSystem;
|
||||||
|
|
||||||
private readonly CloudStorageAccount _storageAccount;
|
Localizer T { get; set; }
|
||||||
public CloudBlobClient BlobClient { get; private set; }
|
|
||||||
public CloudBlobContainer Container { get; private set; }
|
|
||||||
|
|
||||||
Localizer T { get; [UsedImplicitly]
|
|
||||||
set; }
|
|
||||||
|
|
||||||
public AzureShellSettingsManager(IShellSettingsManagerEventHandler events)
|
public AzureShellSettingsManager(IShellSettingsManagerEventHandler events)
|
||||||
: this(CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString")), events)
|
: this(CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString")), events) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AzureShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events)
|
public AzureShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events) {
|
||||||
{
|
|
||||||
// Setup the connection to custom storage accountm, e.g. Development Storage
|
|
||||||
_storageAccount = storageAccount;
|
|
||||||
_events = events;
|
_events = events;
|
||||||
|
_fileSystem = new AzureFileSystem(ContainerName, String.Empty, true, storageAccount);
|
||||||
using ( new HttpContextWeaver() ) {
|
|
||||||
BlobClient = _storageAccount.CreateCloudBlobClient();
|
|
||||||
|
|
||||||
// Get and create the container if it does not exist
|
|
||||||
// The container is named with DNS naming restrictions (i.e. all lower case)
|
|
||||||
Container = new CloudBlobContainer(ContainerName, BlobClient);
|
|
||||||
Container.CreateIfNotExist();
|
|
||||||
|
|
||||||
// Tenant settings are protected by default
|
|
||||||
Container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Off });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<ShellSettings> IShellSettingsManager.LoadSettings() {
|
IEnumerable<ShellSettings> IShellSettingsManager.LoadSettings() {
|
||||||
return LoadSettings().ToArray();
|
var settings = LoadSettings().ToArray();
|
||||||
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IShellSettingsManager.SaveSettings(ShellSettings settings) {
|
void IShellSettingsManager.SaveSettings(ShellSettings settings) {
|
||||||
if ( settings == null )
|
var content = ComposeSettings(settings);
|
||||||
throw new ArgumentException(T("There are no settings to save.").ToString());
|
var filePath = String.Concat(settings.Name, "/", SettingsFilename);
|
||||||
|
var file = _fileSystem.CreateFile(filePath);
|
||||||
if ( string.IsNullOrEmpty(settings.Name) )
|
|
||||||
throw new ArgumentException(T("Settings \"Name\" is not set.").ToString());
|
|
||||||
|
|
||||||
using ( new HttpContextWeaver() ) {
|
using (var stream = file.OpenWrite()) {
|
||||||
var filePath = String.Concat(settings.Name, "/", "Settings.txt");
|
using (var writer = new StreamWriter(stream)) {
|
||||||
var blob = Container.GetBlockBlobReference(filePath);
|
writer.Write(content);
|
||||||
blob.UploadText(ComposeSettings(settings));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_events.Saved(settings);
|
_events.Saved(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<ShellSettings> LoadSettings() {
|
IEnumerable<ShellSettings> LoadSettings() {
|
||||||
|
foreach (var folder in _fileSystem.ListFolders(null))
|
||||||
|
foreach (var file in _fileSystem.ListFiles(folder.GetPath())) {
|
||||||
|
if (!String.Equals(file.GetName(), SettingsFilename))
|
||||||
|
continue;
|
||||||
|
|
||||||
using ( new HttpContextWeaver() ) {
|
using (var stream = file.OpenRead())
|
||||||
var settingsBlobs =
|
using (var reader = new StreamReader(stream))
|
||||||
BlobClient.ListBlobsWithPrefix(Container.Name + "/").OfType<CloudBlobDirectory>()
|
yield return ParseSettings(reader.ReadToEnd());
|
||||||
.SelectMany(directory => directory.ListBlobs()).OfType<CloudBlockBlob>()
|
}
|
||||||
.Where(
|
|
||||||
blob =>
|
|
||||||
string.Equals(Path.GetFileName(blob.Uri.ToString()),
|
|
||||||
"Settings.txt",
|
|
||||||
StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
return settingsBlobs.Select(settingsBlob => ParseSettings(settingsBlob.DownloadText())).ToList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ShellSettings ParseSettings(string text)
|
static ShellSettings ParseSettings(string text) {
|
||||||
{
|
|
||||||
var shellSettings = new ShellSettings();
|
var shellSettings = new ShellSettings();
|
||||||
if (String.IsNullOrEmpty(text))
|
if (String.IsNullOrEmpty(text))
|
||||||
return shellSettings;
|
return shellSettings;
|
||||||
|
|
||||||
string[] settings = text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
string[] settings = text.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (var setting in settings)
|
foreach (var setting in settings) {
|
||||||
{
|
string[] settingFields = setting.Split(new[] {":"}, StringSplitOptions.RemoveEmptyEntries);
|
||||||
string[] settingFields = setting.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
int fieldsLength = settingFields.Length;
|
int fieldsLength = settingFields.Length;
|
||||||
if (fieldsLength != 2)
|
if (fieldsLength != 2)
|
||||||
continue;
|
continue;
|
||||||
for (int i = 0; i < fieldsLength; i++)
|
for (int i = 0; i < fieldsLength; i++) {
|
||||||
{
|
|
||||||
settingFields[i] = settingFields[i].Trim();
|
settingFields[i] = settingFields[i].Trim();
|
||||||
}
|
}
|
||||||
if (settingFields[1] != "null")
|
if (settingFields[1] != "null") {
|
||||||
{
|
switch (settingFields[0]) {
|
||||||
switch (settingFields[0])
|
|
||||||
{
|
|
||||||
case "Name":
|
case "Name":
|
||||||
shellSettings.Name = settingFields[1];
|
shellSettings.Name = settingFields[1];
|
||||||
break;
|
break;
|
||||||
@@ -140,23 +109,22 @@ namespace Orchard.Azure.Environment.Configuration {
|
|||||||
return shellSettings;
|
return shellSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ComposeSettings(ShellSettings settings)
|
static string ComposeSettings(ShellSettings settings) {
|
||||||
{
|
|
||||||
if (settings == null)
|
if (settings == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return string.Format("Name: {0}\r\nDataProvider: {1}\r\nDataConnectionString: {2}\r\nDataPrefix: {3}\r\nRequestUrlHost: {4}\r\nRequestUrlPrefix: {5}\r\nState: {6}\r\nEncryptionAlgorithm: {7}\r\nEncryptionKey: {8}\r\nEncryptionIV: {9}\r\n",
|
return string.Format("Name: {0}\r\nDataProvider: {1}\r\nDataConnectionString: {2}\r\nDataPrefix: {3}\r\nRequestUrlHost: {4}\r\nRequestUrlPrefix: {5}\r\nState: {6}\r\nEncryptionAlgorithm: {7}\r\nEncryptionKey: {8}\r\nEncryptionIV: {9}\r\n",
|
||||||
settings.Name,
|
settings.Name,
|
||||||
settings.DataProvider,
|
settings.DataProvider,
|
||||||
settings.DataConnectionString ?? "null",
|
settings.DataConnectionString ?? "null",
|
||||||
settings.DataTablePrefix ?? "null",
|
settings.DataTablePrefix ?? "null",
|
||||||
settings.RequestUrlHost ?? "null",
|
settings.RequestUrlHost ?? "null",
|
||||||
settings.RequestUrlPrefix ?? "null",
|
settings.RequestUrlPrefix ?? "null",
|
||||||
settings.State != null ? settings.State.ToString() : String.Empty,
|
settings.State != null ? settings.State.ToString() : String.Empty,
|
||||||
settings.EncryptionAlgorithm ?? "null",
|
settings.EncryptionAlgorithm ?? "null",
|
||||||
settings.EncryptionKey ?? "null",
|
settings.EncryptionKey ?? "null",
|
||||||
settings.EncryptionIV ?? "null"
|
settings.EncryptionIV ?? "null"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
108
src/Orchard.Azure/Orchard.Azure.5.0.ReSharper
Normal file
108
src/Orchard.Azure/Orchard.Azure.5.0.ReSharper
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<Configuration>
|
||||||
|
<CodeStyleSettings>
|
||||||
|
<ExternalPath IsNull="False">
|
||||||
|
</ExternalPath>
|
||||||
|
<Sharing>SOLUTION</Sharing>
|
||||||
|
<CSharp>
|
||||||
|
<FormatSettings>
|
||||||
|
<ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>False</ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>
|
||||||
|
<ALIGN_MULTILINE_FOR_STMT>False</ALIGN_MULTILINE_FOR_STMT>
|
||||||
|
<ALIGN_MULTIPLE_DECLARATION>False</ALIGN_MULTIPLE_DECLARATION>
|
||||||
|
<ANONYMOUS_METHOD_DECLARATION_BRACES>END_OF_LINE</ANONYMOUS_METHOD_DECLARATION_BRACES>
|
||||||
|
<CASE_BLOCK_BRACES>END_OF_LINE</CASE_BLOCK_BRACES>
|
||||||
|
<EMPTY_BLOCK_STYLE>TOGETHER</EMPTY_BLOCK_STYLE>
|
||||||
|
<FORCE_FIXED_BRACES_STYLE>ALWAYS_ADD</FORCE_FIXED_BRACES_STYLE>
|
||||||
|
<FORCE_FOR_BRACES_STYLE>ALWAYS_ADD</FORCE_FOR_BRACES_STYLE>
|
||||||
|
<FORCE_FOREACH_BRACES_STYLE>ALWAYS_ADD</FORCE_FOREACH_BRACES_STYLE>
|
||||||
|
<FORCE_IFELSE_BRACES_STYLE>ALWAYS_ADD</FORCE_IFELSE_BRACES_STYLE>
|
||||||
|
<FORCE_USING_BRACES_STYLE>ALWAYS_ADD</FORCE_USING_BRACES_STYLE>
|
||||||
|
<FORCE_WHILE_BRACES_STYLE>ALWAYS_ADD</FORCE_WHILE_BRACES_STYLE>
|
||||||
|
<INITIALIZER_BRACES>END_OF_LINE</INITIALIZER_BRACES>
|
||||||
|
<INVOCABLE_DECLARATION_BRACES>END_OF_LINE</INVOCABLE_DECLARATION_BRACES>
|
||||||
|
<MODIFIERS_ORDER IsNull="False">
|
||||||
|
<Item>public</Item>
|
||||||
|
<Item>protected</Item>
|
||||||
|
<Item>internal</Item>
|
||||||
|
<Item>private</Item>
|
||||||
|
<Item>new</Item>
|
||||||
|
<Item>abstract</Item>
|
||||||
|
<Item>virtual</Item>
|
||||||
|
<Item>override</Item>
|
||||||
|
<Item>sealed</Item>
|
||||||
|
<Item>static</Item>
|
||||||
|
<Item>readonly</Item>
|
||||||
|
<Item>extern</Item>
|
||||||
|
<Item>unsafe</Item>
|
||||||
|
<Item>volatile</Item>
|
||||||
|
</MODIFIERS_ORDER>
|
||||||
|
<OTHER_BRACES>END_OF_LINE</OTHER_BRACES>
|
||||||
|
<TYPE_DECLARATION_BRACES>END_OF_LINE</TYPE_DECLARATION_BRACES>
|
||||||
|
<WRAP_LINES>False</WRAP_LINES>
|
||||||
|
</FormatSettings>
|
||||||
|
<UsingsSettings />
|
||||||
|
<Naming2>
|
||||||
|
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
|
||||||
|
<EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
|
||||||
|
<ExceptionName IsNull="False">
|
||||||
|
</ExceptionName>
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
|
||||||
|
</Naming2>
|
||||||
|
</CSharp>
|
||||||
|
<VB>
|
||||||
|
<FormatSettings />
|
||||||
|
<ImportsSettings />
|
||||||
|
<Naming2>
|
||||||
|
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
|
||||||
|
<EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
|
||||||
|
</Naming2>
|
||||||
|
</VB>
|
||||||
|
<Web>
|
||||||
|
<Naming2 />
|
||||||
|
</Web>
|
||||||
|
<Xaml>
|
||||||
|
<Naming2 />
|
||||||
|
</Xaml>
|
||||||
|
<XML>
|
||||||
|
<FormatSettings />
|
||||||
|
</XML>
|
||||||
|
<GenerateMemberBody />
|
||||||
|
<Naming2>
|
||||||
|
<EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
|
||||||
|
<EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
|
||||||
|
<ExceptionName IsNull="False">
|
||||||
|
</ExceptionName>
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PublicFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
|
||||||
|
<PredefinedRule Inspect="False" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
|
||||||
|
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
|
||||||
|
<Abbreviation Text="SQ" />
|
||||||
|
</Naming2>
|
||||||
|
</CodeStyleSettings>
|
||||||
|
</Configuration>
|
@@ -1,6 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ServiceDefinition name="OrchardCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
|
<ServiceDefinition name="OrchardCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
|
||||||
<WebRole name="Orchard.Azure.Web">
|
<WebRole name="Orchard.Azure.Web">
|
||||||
|
<!--<Sites>
|
||||||
|
<Site name="Web">
|
||||||
|
<Bindings>
|
||||||
|
<Binding name="HttpIn" endpointName="HttpIn" />
|
||||||
|
</Bindings>
|
||||||
|
</Site>
|
||||||
|
</Sites>-->
|
||||||
<ConfigurationSettings>
|
<ConfigurationSettings>
|
||||||
<Setting name="DiagnosticsConnectionString" />
|
<Setting name="DiagnosticsConnectionString" />
|
||||||
<Setting name="DataConnectionString" />
|
<Setting name="DataConnectionString" />
|
||||||
|
Reference in New Issue
Block a user