Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(cloudbuilder): Add UsePersistedStoragePath configuration to c… #643

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Client/Api/Builder/ICamundaCloudClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ public interface ICamundaCloudClientBuilderFinalStep
/// <returns>the next step in building a ICamundaCloudClient</returns>
ICamundaCloudClientBuilderFinalStep UseAuthServer(string url);

/// <summary>
/// Sets the given path to store credentials on disk.
/// </summary>
/// <param name="path">the path where to store the credentials.</param>
/// <returns>the fluent ICamundaCloudClientBuilderFinalStep.</returns>
ICamundaCloudClientBuilderFinalStep UsePersistedStoragePath(string path);

/// <summary>
/// The IZeebeClient, which is setup entirely to talk with the defined Camunda Cloud cluster.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Client/Api/Builder/ICamundaCloudTokenProviderBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public interface ICamundaCloudTokenProviderBuilderFinalStep
/// Use given path to store credentials on disk.
/// </summary>
/// Per default credentials are stored in the home directory.
/// <param name="path">The path were to store the credentials.</param>
/// <param name="path">The path where to store the credentials.</param>
/// <returns>The final step in building a CamundaCloudTokenProvider.</returns>
ICamundaCloudTokenProviderBuilderFinalStep UsePath(string path);

Expand Down
12 changes: 12 additions & 0 deletions Client/Impl/Builder/CamundaCloudClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ public ICamundaCloudClientBuilderFinalStep UseAuthServer(string url)
return this;
}

public ICamundaCloudClientBuilderFinalStep UsePersistedStoragePath(string path)
{
if (path is null)
{
// use default
return this;
}
Comment on lines +80 to +84
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to remove this, since we handle nulls here https://github.com/camunda-community-hub/zeebe-client-csharp/blob/main/Client/Impl/Builder/CamundaCloudTokenProviderBuilder.cs#L78-L83 and would like to fail if we put null in (likely by mistake, otherwise we would hide this and only realize later that we are not writing to the expected path)


camundaCloudTokenProviderBuilder.UsePath(path);
return this;
}

private string GetFromEnv(string key)
{
char[] charsToTrim = { ' ', '\'' };
Expand Down
Loading