Skip to content

Commit 39e5683

Browse files
authored
Change key names (#15)
* Fix some lingering apiKey, PREFAB_API_KEY, prefab references in logs * Bumps version to 1.0.1
1 parent 4b8e18d commit 39e5683

12 files changed

Lines changed: 30 additions & 30 deletions

File tree

micronaut/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Maven
2020
<dependency>
2121
<groupId>com.reforge</groupId>
2222
<artifactId>sdk-micronaut-extension</artifactId>
23-
<version>1.0.0</version>
23+
<version>LATEST</version>
2424
</dependency>
2525
```
2626

micronaut/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.reforge</groupId>
66
<artifactId>sdk-parent</artifactId>
7-
<version>1.0.0</version>
7+
<version>1.0.1</version>
88
</parent>
99

1010
<artifactId>sdk-micronaut-extension</artifactId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<groupId>com.reforge</groupId>
1212
<artifactId>sdk-parent</artifactId>
1313

14-
<version>1.0.0</version>
14+
<version>1.0.1</version>
1515
<packaging>pom</packaging>
1616
<name>Reforge SDK Parent POM</name>
1717
<description>Parent POM for Reforge SDK modules providing feature flags, configuration management, and A/B testing capabilities</description>

sdk/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See full documentation https://docs.reforge.com/docs/java-sdk/java
1313
<dependency>
1414
<groupId>com.reforge</groupId>
1515
<artifactId>sdk</artifactId>
16-
<version>0.3.26</version>
16+
<version>LATEST</version>
1717
</dependency>
1818
```
1919

@@ -25,7 +25,7 @@ For an uber-jar including relocated guava and failsafe dependencies add the "ube
2525
<dependency>
2626
<groupId>com.reforge</groupId>
2727
<artifactId>sdk</artifactId>
28-
<version>0.3.26</version>
28+
<version>LATEST</version>
2929
<classifier>uberjar</classifier>
3030
</dependency>
3131
```

sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.reforge</groupId>
66
<artifactId>sdk-parent</artifactId>
7-
<version>1.0.0</version>
7+
<version>1.0.1</version>
88
</parent>
99

1010
<artifactId>sdk</artifactId>

sdk/src/main/java/com/reforge/sdk/Options.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public enum CollectContextMode {
4545
PERIODIC_EXAMPLE,
4646
}
4747

48-
private String apikey;
48+
private String sdkKey;
4949
private Datasources datasources = Datasources.ALL;
5050
private int initializationTimeoutSec = 10;
5151
private OnInitializationFailure onInitializationFailure = OnInitializationFailure.RAISE;
@@ -72,7 +72,7 @@ public enum CollectContextMode {
7272
private ContextSetReadable globalContext;
7373

7474
public Options() {
75-
setApikey(
75+
setSdkKey(
7676
Optional
7777
.ofNullable(System.getenv("REFORGE_BACKEND_SDK_KEY"))
7878
.orElse(System.getenv("PREFAB_API_KEY"))
@@ -87,21 +87,21 @@ public boolean isLocalOnly() {
8787
return Datasources.LOCAL_ONLY == datasources;
8888
}
8989

90-
public String getApikey() {
91-
return apikey;
90+
public String getSdkKey() {
91+
return sdkKey;
9292
}
9393

9494
/**
9595
* Sets the API key to be used to communicate with the Reforge APIs
96-
* Can also be specified with env var `REFORGE_API_KEY`
97-
* @param apikey the key
96+
* Can also be specified with env var `REFORGE_BACKEND_SDK_KEY`
97+
* @param sdkKey the key
9898
* @return Options
9999
*/
100-
public Options setApikey(String apikey) {
101-
if (apikey == null) {
102-
this.apikey = null;
100+
public Options setSdkKey(String sdkKey) {
101+
if (sdkKey == null) {
102+
this.sdkKey = null;
103103
} else {
104-
this.apikey = apikey.trim();
104+
this.sdkKey = sdkKey.trim();
105105
}
106106
return this;
107107
}
@@ -223,7 +223,7 @@ public Options setCollectEvaluationSummaries(boolean collectEvaluationSummaries)
223223
}
224224

225225
public String getApiKeyId() {
226-
return getApikey().split("\\-")[0];
226+
return getSdkKey().split("\\-")[0];
227227
}
228228

229229
public Options setContextStore(ContextStore contextStore) {

sdk/src/main/java/com/reforge/sdk/Sdk.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public Sdk(Options options) {
1919
this.options = options;
2020

2121
if (options.isLocalOnly()) {
22-
LOG.info("Initializing Prefab LocalOnly");
22+
LOG.info("Initializing Reforge SDK LocalOnly");
2323
} else if (options.isLocalDatafileMode()) {
24-
LOG.info("Initializing Prefab from local file {}", options.getLocalDatafile());
24+
LOG.info("Initializing Reforge SDK from local file {}", options.getLocalDatafile());
2525
} else {
26-
if (options.getApikey() == null || options.getApikey().isEmpty()) {
27-
throw new RuntimeException("PREFAB_API_KEY not set");
26+
if (options.getSdkKey() == null || options.getSdkKey().isEmpty()) {
27+
throw new RuntimeException("REFORGE_BACKEND_SDK_KEY not set");
2828
}
29-
LOG.info("Initializing Prefab for apiKeyId {}", options.getApiKeyId());
29+
LOG.info("Initializing Reforge SDK for sdkKeyId {}", options.getApiKeyId());
3030
}
3131

3232
this.closed = new AtomicBoolean(false);

sdk/src/main/java/com/reforge/sdk/internal/HttpClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ private HttpRequest.Builder getClientBuilderWithStandardHeaders() {
356356
.header(VERSION_HEADER, NEW_CLIENT_HEADER_VALUE)
357357
.header(
358358
"Authorization",
359-
getBasicAuthenticationHeader(options.getApiKeyId(), options.getApikey())
359+
getBasicAuthenticationHeader(options.getApiKeyId(), options.getSdkKey())
360360
);
361361
}
362362

@@ -375,7 +375,7 @@ private void checkForAuthFailure(HttpResponse<?> httpResponse, Throwable throwab
375375
if (throwable == null) {
376376
if (AUTH_PROBLEM_STATUS_CODES.contains(httpResponse.statusCode())) {
377377
LOG.error(
378-
"*** Prefab Auth failure, please check your credentials. Fetching configuration returned HTTP Status code {} (from {}) ",
378+
"*** Reforge SDK Auth failure, please check your credentials. Fetching configuration returned HTTP Status code {} (from {}) ",
379379
httpResponse.statusCode(),
380380
httpResponse.uri()
381381
);

sdk/src/test/java/com/reforge/sdk/OptionsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void testStreamDomain() {
3636
@Test
3737
public void apiKeyIsTrimmed() {
3838
Options options = new Options();
39-
options.setApikey("my-key\n");
40-
assertThat(options.getApikey()).isEqualTo("my-key");
39+
options.setSdkKey("my-key\n");
40+
assertThat(options.getSdkKey()).isEqualTo("my-key");
4141
}
4242
}

sdk/src/test/java/com/reforge/sdk/integration/BaseIntegrationTestCaseDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private Sdk buildClient(IntegrationTestClientOverrides clientOverrides) {
8484
}
8585

8686
Options options = new Options()
87-
.setApikey(apiKey)
87+
.setSdkKey(apiKey)
8888
.setTelemetryHost("https://telemetry.goatsofreforge.com")
8989
.setApiHosts(List.of("https://api.goatsofreforge.com"))
9090
.setStreamHosts(List.of("https://stream.goatsofreforge.com"))

0 commit comments

Comments
 (0)