From c4f1f7635185ebe11255a8e20bb72a11a6c351bf Mon Sep 17 00:00:00 2001 From: Nate Barbettini Date: Wed, 29 Jun 2016 14:18:41 -0700 Subject: [PATCH] Add support for changing config file root --- Stormpath.SDK.nuspec | 6 +++--- .../Client/IClientBuilder.cs | 8 ++++++++ src/Stormpath.SDK.Abstractions/project.json | 4 ++-- .../Impl/Client/DefaultClientBuilder.cs | 10 +++++++++- src/Stormpath.SDK.Core/project.json | 6 +++--- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Stormpath.SDK.nuspec b/Stormpath.SDK.nuspec index bff402c6..28944829 100644 --- a/Stormpath.SDK.nuspec +++ b/Stormpath.SDK.nuspec @@ -2,7 +2,7 @@ Stormpath.SDK - 0.91.0 + 0.92.0 Nate Barbettini Stormpath, Inc. https://github.com/stormpath/stormpath-sdk-csharp/blob/master/LICENSE @@ -14,12 +14,12 @@ Stormpath API Authentication Authorization REST - + - + diff --git a/src/Stormpath.SDK.Abstractions/Client/IClientBuilder.cs b/src/Stormpath.SDK.Abstractions/Client/IClientBuilder.cs index ac197ad8..b6be534c 100644 --- a/src/Stormpath.SDK.Abstractions/Client/IClientBuilder.cs +++ b/src/Stormpath.SDK.Abstractions/Client/IClientBuilder.cs @@ -167,6 +167,14 @@ public interface IClientBuilder : ILoggerConsumer, ISerializerCo /// IClientBuilder SetConfiguration(object configuration); + /// + /// Sets the base path that is used when searching for configuration files (stormpath.json, etc). + /// If the value is null, the current directory is searched. + /// + /// The path. + /// This instance for method chaining. + IClientBuilder SetConfigurationFileRoot(string path); + /// /// Sets the authentication scheme to use when making requests. /// diff --git a/src/Stormpath.SDK.Abstractions/project.json b/src/Stormpath.SDK.Abstractions/project.json index 3e1def51..9e452416 100644 --- a/src/Stormpath.SDK.Abstractions/project.json +++ b/src/Stormpath.SDK.Abstractions/project.json @@ -8,7 +8,7 @@ }, "copyright": "(c) 2016 Stormpath, Inc.", "dependencies": { - "Stormpath.Configuration.Abstractions": "5.2.0" + "Stormpath.Configuration.Abstractions": "5.3.0" }, "description": "Abstractions for the Stormpath .NET SDK.", "frameworks": { @@ -36,5 +36,5 @@ "tooling": { "defaultNamespace": "Stormpath.SDK" }, - "version": "0.91.0" + "version": "0.92.0" } diff --git a/src/Stormpath.SDK.Core/Impl/Client/DefaultClientBuilder.cs b/src/Stormpath.SDK.Core/Impl/Client/DefaultClientBuilder.cs index 9f70f1bb..d14e58f5 100644 --- a/src/Stormpath.SDK.Core/Impl/Client/DefaultClientBuilder.cs +++ b/src/Stormpath.SDK.Core/Impl/Client/DefaultClientBuilder.cs @@ -47,6 +47,7 @@ internal sealed class DefaultClientBuilder : IClientBuilder // Set if the user supplies a configuration to use private StormpathConfiguration useConfiguration = null; private object useConfigurationAnonymous = null; + private string configurationFileBasePath = null; // These are for backwards compatibility and will be removed at 1.0 [Obsolete] @@ -93,6 +94,12 @@ IClientBuilder IClientBuilder.SetConfiguration(object configuration) return this; } + IClientBuilder IClientBuilder.SetConfigurationFileRoot(string path) + { + this.configurationFileBasePath = path; + return this; + } + IClientBuilder IClientBuilder.SetApiKey(IClientApiKey apiKey) { if (!apiKey.IsValid()) @@ -335,7 +342,8 @@ IClient IClientBuilder.Build() ?? this.useConfigurationAnonymous ?? CreateSuppliedConfiguration(); - var finalConfiguration = ConfigurationLoader.Initialize().Load(suppliedConfiguration); // TODO: restore logging + // TODO: restore logging + var finalConfiguration = ConfigurationLoader.Initialize().Load(suppliedConfiguration, configurationFileBasePath); ThrowForInvalidConfiguration(finalConfiguration); diff --git a/src/Stormpath.SDK.Core/project.json b/src/Stormpath.SDK.Core/project.json index 46917daf..1962cb20 100644 --- a/src/Stormpath.SDK.Core/project.json +++ b/src/Stormpath.SDK.Core/project.json @@ -9,10 +9,10 @@ "copyright": "(c) 2016 Stormpath, Inc.", "dependencies": { "Polyglot": "1.2.0", - "Stormpath.Configuration": "5.2.0", + "Stormpath.Configuration": "5.3.0", "Stormpath.SDK.Abstractions": { "target": "project", - "version": "0.91.0" + "version": "0.92.0" }, "System.Runtime.InteropServices.RuntimeInformation": "4.0.0" }, @@ -55,5 +55,5 @@ "tooling": { "defaultNamespace": "Stormpath.SDK" }, - "version": "0.91.0" + "version": "0.92.0" }