Skip to content
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
2 changes: 1 addition & 1 deletion micronaut/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Maven
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk-micronaut-extension</artifactId>
<version>1.0.0</version>
<version>LATEST</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion micronaut/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.reforge</groupId>
<artifactId>sdk-parent</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<artifactId>sdk-micronaut-extension</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<groupId>com.reforge</groupId>
<artifactId>sdk-parent</artifactId>

<version>1.0.0</version>
<version>1.0.1</version>
<packaging>pom</packaging>
<name>Reforge SDK Parent POM</name>
<description>Parent POM for Reforge SDK modules providing feature flags, configuration management, and A/B testing capabilities</description>
Expand Down
4 changes: 2 additions & 2 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See full documentation https://docs.reforge.com/docs/java-sdk/java
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk</artifactId>
<version>0.3.26</version>
<version>LATEST</version>
</dependency>
```

Expand All @@ -25,7 +25,7 @@ For an uber-jar including relocated guava and failsafe dependencies add the "ube
<dependency>
<groupId>com.reforge</groupId>
<artifactId>sdk</artifactId>
<version>0.3.26</version>
<version>LATEST</version>
<classifier>uberjar</classifier>
</dependency>
```
Expand Down
2 changes: 1 addition & 1 deletion sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.reforge</groupId>
<artifactId>sdk-parent</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>

<artifactId>sdk</artifactId>
Expand Down
22 changes: 11 additions & 11 deletions sdk/src/main/java/com/reforge/sdk/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public enum CollectContextMode {
PERIODIC_EXAMPLE,
}

private String apikey;
private String sdkKey;
private Datasources datasources = Datasources.ALL;
private int initializationTimeoutSec = 10;
private OnInitializationFailure onInitializationFailure = OnInitializationFailure.RAISE;
Expand All @@ -72,7 +72,7 @@ public enum CollectContextMode {
private ContextSetReadable globalContext;

public Options() {
setApikey(
setSdkKey(
Optional
.ofNullable(System.getenv("REFORGE_BACKEND_SDK_KEY"))
.orElse(System.getenv("PREFAB_API_KEY"))
Expand All @@ -87,21 +87,21 @@ public boolean isLocalOnly() {
return Datasources.LOCAL_ONLY == datasources;
}

public String getApikey() {
return apikey;
public String getSdkKey() {
return sdkKey;
}

/**
* Sets the API key to be used to communicate with the Reforge APIs
* Can also be specified with env var `REFORGE_API_KEY`
* @param apikey the key
* Can also be specified with env var `REFORGE_BACKEND_SDK_KEY`
* @param sdkKey the key
* @return Options
*/
public Options setApikey(String apikey) {
if (apikey == null) {
this.apikey = null;
public Options setSdkKey(String sdkKey) {
if (sdkKey == null) {
this.sdkKey = null;
} else {
this.apikey = apikey.trim();
this.sdkKey = sdkKey.trim();
}
return this;
}
Expand Down Expand Up @@ -223,7 +223,7 @@ public Options setCollectEvaluationSummaries(boolean collectEvaluationSummaries)
}

public String getApiKeyId() {
return getApikey().split("\\-")[0];
return getSdkKey().split("\\-")[0];
}

public Options setContextStore(ContextStore contextStore) {
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/main/java/com/reforge/sdk/Sdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public Sdk(Options options) {
this.options = options;

if (options.isLocalOnly()) {
LOG.info("Initializing Prefab LocalOnly");
LOG.info("Initializing Reforge SDK LocalOnly");
} else if (options.isLocalDatafileMode()) {
LOG.info("Initializing Prefab from local file {}", options.getLocalDatafile());
LOG.info("Initializing Reforge SDK from local file {}", options.getLocalDatafile());
} else {
if (options.getApikey() == null || options.getApikey().isEmpty()) {
throw new RuntimeException("PREFAB_API_KEY not set");
if (options.getSdkKey() == null || options.getSdkKey().isEmpty()) {
throw new RuntimeException("REFORGE_BACKEND_SDK_KEY not set");
}
LOG.info("Initializing Prefab for apiKeyId {}", options.getApiKeyId());
LOG.info("Initializing Reforge SDK for sdkKeyId {}", options.getApiKeyId());
}

this.closed = new AtomicBoolean(false);
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/java/com/reforge/sdk/internal/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private HttpRequest.Builder getClientBuilderWithStandardHeaders() {
.header(VERSION_HEADER, NEW_CLIENT_HEADER_VALUE)
.header(
"Authorization",
getBasicAuthenticationHeader(options.getApiKeyId(), options.getApikey())
getBasicAuthenticationHeader(options.getApiKeyId(), options.getSdkKey())
);
}

Expand All @@ -375,7 +375,7 @@ private void checkForAuthFailure(HttpResponse<?> httpResponse, Throwable throwab
if (throwable == null) {
if (AUTH_PROBLEM_STATUS_CODES.contains(httpResponse.statusCode())) {
LOG.error(
"*** Prefab Auth failure, please check your credentials. Fetching configuration returned HTTP Status code {} (from {}) ",
"*** Reforge SDK Auth failure, please check your credentials. Fetching configuration returned HTTP Status code {} (from {}) ",
httpResponse.statusCode(),
httpResponse.uri()
);
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/test/java/com/reforge/sdk/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testStreamDomain() {
@Test
public void apiKeyIsTrimmed() {
Options options = new Options();
options.setApikey("my-key\n");
assertThat(options.getApikey()).isEqualTo("my-key");
options.setSdkKey("my-key\n");
assertThat(options.getSdkKey()).isEqualTo("my-key");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private Sdk buildClient(IntegrationTestClientOverrides clientOverrides) {
}

Options options = new Options()
.setApikey(apiKey)
.setSdkKey(apiKey)
.setTelemetryHost("https://telemetry.goatsofreforge.com")
.setApiHosts(List.of("https://api.goatsofreforge.com"))
.setStreamHosts(List.of("https://stream.goatsofreforge.com"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void localModeUnlocks() {
void initializationTimeout() {
final Sdk baseClient = new Sdk(
new Options()
.setApikey("0-P1-E1-SDK-1234-123-23")
.setSdkKey("0-P1-E1-SDK-1234-123-23")
.setInitializationTimeoutSec(1)
.setOnInitializationFailure(Options.OnInitializationFailure.RAISE)
);
Expand All @@ -57,7 +57,7 @@ void initializationTimeout() {
void initializationUnlock() {
final Sdk baseClient = new Sdk(
new Options()
.setApikey("0-P1-E1-SDK-1234-123-23")
.setSdkKey("0-P1-E1-SDK-1234-123-23")
.setInitializationTimeoutSec(1)
.setOnInitializationFailure(Options.OnInitializationFailure.UNLOCK)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HttpClientTest {
Options options = new Options()
.setApiHosts(List.of("http://a.example.com", "http://b.example.com"))
.setStreamHosts(List.of("http://stream.example.com"))
.setApikey("not-a-real-key")
.setSdkKey("not-a-real-key")
.setTelemetryHost("http://telemetry.example.com");

HttpClient prefabHttpClient;
Expand Down