From ee0cb7a8f5df29896fe9353d141f76f1db4a7f41 Mon Sep 17 00:00:00 2001 From: George Thomas Shanti Date: Mon, 4 Sep 2023 17:31:32 +0530 Subject: [PATCH] Uses v character in github release tag but not in package and updates the readme --- .github/workflows/release.yml | 2 +- README.md | 70 +++++++++-------------------------- build.gradle.kts | 2 +- 3 files changed, 20 insertions(+), 54 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e50a5d..ec787dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Build and publish the Java SDK on: push: tags: - - '[0-9]+.[0-9]+.[0-9]+*' # 0.0.1 - this syntax of tags is supported + - 'v[0-9]+.[0-9]+.[0-9]+*' # 0.0.1 - this syntax of tags is supported jobs: build-and-publish-java-sdk: diff --git a/README.md b/README.md index 5571865..3e918dd 100644 --- a/README.md +++ b/README.md @@ -7,63 +7,25 @@ The CommandK SDK enables users to fetch secrets programmatically, either directl ```gradle repositories { maven { - url = uri("https://maven.pkg.github.com/commandk-dev/java-sdk") - credentials { - username = "" - password = "" - } + url = uri("https://mvn.cmdk.sh") } + mavenCentral() } dependencies { - implementation 'dev.commandk:java-sdk:v0.0.4' + implementation 'dev.commandk:java-sdk:0.1.0:all' } ``` ### Maven users -In your `settings.xml` file usually located at `~/.m2/settings.xml` add this repository: -```xml - - - - github - - - - - github - - - github - https://maven.pkg.github.com/commandk-dev/java-sdk/ - - true - - - - - - - - - github - username - access_token - - - -``` -And in your project's `pom.xml` file add: +In your project's `pom.xml` file add the repository and dependency: ```xml - github - https://maven.pkg.github.com/commandk-dev/java-sdk - - true - + commandk + https://mvn.cmdk.sh @@ -71,7 +33,7 @@ And in your project's `pom.xml` file add: dev.commandk java-sdk - v0.0.4 + 0.1.0 all @@ -93,7 +55,7 @@ public class Main { // The host and access token need to be provided to the client somehow. // One of the ways the client tries to access it is by looking them up in the // system properties with the `commandk.host` and `commandk.apiToken` properties. - System.setProperty("commandk.host", "https://api..commandk.dev"); + System.setProperty("commandk.host", "https://api.commandk.dev"); System.setProperty("commandk.apiToken", ""); // With the default configuration, the client will pick up the credentials from @@ -103,7 +65,8 @@ public class Main { // To fetch secrets of an app we need to specify the app id and the environment id List renderedAppSecrets = commandKClient.getRenderedAppSecrets( "", - "" + "", // staging, production, sandbox, development, + List.of() ); // And it's ready to be consumed @@ -132,12 +95,14 @@ The default configuration is what the example above uses. It will look up the ho 3.2 At the location provided in the java system property `commandk.configFile` *In our example the client finds the credentials we set in the java system properties.* +> **NOTE** If you are using an on-prem installation of commandk, your host value would look like this `https://api..commandk.dev` +> For the value of `host`, refer to the Customer Information Sheet that would have been shared by the CommandK team for your installation. Usually, if you access your dashboard at `app..commandk.dev`, then the host for your commandk installation would be `https://api..commandk.dev` #### Using the configuration file Instead of setting the credentials directly in the system properties you could also load them up from a file. 1. Create a file at `~/commandk.config` ``` -host: https://api..commandk.dev +host: https://api.commandk.dev apiToken: ``` 2. Set the environment variable @@ -156,7 +121,7 @@ or like in the example set the system property in the application // The host and access token need to be provided to the client somehow. // One of the ways the client tries to access it is by looking them up in the // system properties with the `commandk.host` and `commandk.apiToken` properties. -System.setProperty("commandk.host", "https://api..commandk.dev"); +System.setProperty("commandk.host", "https://api.commandk.dev"); System.setProperty("commandk.apiToken", ""); // with this @@ -170,7 +135,7 @@ class CustomCredentialsProvider implements CommandKCredentialsProvider { @Override public CommandKCredentials resolveCredentials() { - return new CommandKCredentials("https://api..commandk.dev", ""); + return new CommandKCredentials("https://api.commandk.dev", ""); } } ``` @@ -200,7 +165,8 @@ public class Main { // To fetch secrets of an app we need to specify the app id and the environment id List renderedAppSecrets = commandKClient.getRenderedAppSecrets( "", - "" + "", + List.of() ); // And it's ready to be consumed @@ -214,7 +180,7 @@ class CredentialProviderExample implements CommandKCredentialsProvider { @Override public CommandKCredentials resolveCredentials() { - return new CommandKCredentials("https://api..commandk.dev", ""); + return new CommandKCredentials("https://api.commandk.dev", ""); } } ``` diff --git a/build.gradle.kts b/build.gradle.kts index 7f7b066..78b8365 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -134,7 +134,7 @@ publishing { create("main") { groupId = "dev.commandk" artifactId = "java-sdk" - version = System.getenv("VERSION_TAG") ?: version + version = System.getenv("VERSION_TAG")?.replace("v", "") ?: version from(components["java"]) }