From cc83a999a54db05a4bc2b169365d4f6e33728abf Mon Sep 17 00:00:00 2001 From: Louis Chan Date: Thu, 25 Apr 2024 16:24:42 -0700 Subject: [PATCH] fix: Use LAUNCHDARKLY_SDK_KEY instead --- README.md | 4 ++-- src/main/java/Hello.java | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ceb55ff..03bc875 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ Below, you'll find the basic build procedure, but for more comprehensive instruc This project uses [Gradle](https://gradle.org/). It requires that Java is already installed on your system (version 8 or higher). It will automatically use the latest release of the LaunchDarkly SDK with major version 7. -1. Set the value of environment variable `LAUNCHDARKLY_SERVER_KEY` to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, edit `src/main/java/Hello.java` and set `FEATURE_FLAG_KEY` in code to the flag key. +1. Set the value of environment variable `LAUNCHDARKLY_SDK_KEY` to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, edit `src/main/java/Hello.java` and set `FEATURE_FLAG_KEY` in code to the flag key. ```sh - export LAUNCHDARKLY_SERVER_KEY=1234567890abcdef + export LAUNCHDARKLY_SDK_KEY=1234567890abcdef ``` ```java diff --git a/src/main/java/Hello.java b/src/main/java/Hello.java index 0f8aac0..2fd5f4c 100644 --- a/src/main/java/Hello.java +++ b/src/main/java/Hello.java @@ -29,12 +29,9 @@ private static void showBanner() { } public static void main(String... args) throws Exception { - // Set this environment variable to skip the loop process and evaluate the flag - // a single time. boolean CIMode = System.getenv("CI") != null; - // Get SDK Key from env variable LAUNCHDARKLY_SERVER_KEY - String envSDKKey = System.getenv("LAUNCHDARKLY_SERVER_KEY"); + String envSDKKey = System.getenv("LAUNCHDARKLY_SDK_KEY"); if(envSDKKey != null) { SDK_KEY = envSDKKey; } @@ -47,7 +44,7 @@ public static void main(String... args) throws Exception { LDConfig config = new LDConfig.Builder().build(); if (SDK_KEY == null || SDK_KEY.equals("")) { - showMessage("Please set the LAUNCHDARKLY_SERVER_KEY environment variable or edit Hello.java to set SDK_KEY to your LaunchDarkly SDK key first."); + showMessage("Please set the LAUNCHDARKLY_SDK_KEY environment variable or edit Hello.java to set SDK_KEY to your LaunchDarkly SDK key first."); System.exit(1); }