Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Add support for changing config file root
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarbettini committed Jun 29, 2016
1 parent eac4fb9 commit c4f1f76
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Stormpath.SDK.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Stormpath.SDK</id>
<version>0.91.0</version>
<version>0.92.0</version>
<authors>Nate Barbettini</authors>
<owners>Stormpath, Inc.</owners>
<licenseUrl>https://github.com/stormpath/stormpath-sdk-csharp/blob/master/LICENSE</licenseUrl>
Expand All @@ -14,12 +14,12 @@
<tags>Stormpath API Authentication Authorization REST</tags>
<dependencies>
<group targetFramework=".NETStandard1.3">
<dependency id="Stormpath.SDK.Core" version="[0.91.0, )" />
<dependency id="Stormpath.SDK.Core" version="[0.92.0, )" />
<dependency id="Stormpath.SDK.Http.SystemNetHttpClient" version="[0.91.0, )" />
<dependency id="Stormpath.SDK.JsonNetSerializer" version="[0.91.0, )" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="Stormpath.SDK.Core" version="[0.91.0, )" />
<dependency id="Stormpath.SDK.Core" version="[0.92.0, )" />
<dependency id="Stormpath.SDK.RestSharpClient" version="[0.91.0, )" />
<dependency id="Stormpath.SDK.JsonNetSerializer" version="[0.91.0, )" />
</group>
Expand Down
8 changes: 8 additions & 0 deletions src/Stormpath.SDK.Abstractions/Client/IClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ public interface IClientBuilder : ILoggerConsumer<IClientBuilder>, ISerializerCo
/// </example>
IClientBuilder SetConfiguration(object configuration);

/// <summary>
/// Sets the base path that is used when searching for configuration files (<c>stormpath.json</c>, etc).
/// If the value is <c>null</c>, the current directory is searched.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>This instance for method chaining.</returns>
IClientBuilder SetConfigurationFileRoot(string path);

/// <summary>
/// Sets the authentication scheme to use when making requests.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Stormpath.SDK.Abstractions/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -36,5 +36,5 @@
"tooling": {
"defaultNamespace": "Stormpath.SDK"
},
"version": "0.91.0"
"version": "0.92.0"
}
10 changes: 9 additions & 1 deletion src/Stormpath.SDK.Core/Impl/Client/DefaultClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/Stormpath.SDK.Core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -55,5 +55,5 @@
"tooling": {
"defaultNamespace": "Stormpath.SDK"
},
"version": "0.91.0"
"version": "0.92.0"
}

0 comments on commit c4f1f76

Please sign in to comment.