diff --git a/frontend/src/component/onboarding/dialog/SdkConnected.tsx b/frontend/src/component/onboarding/dialog/SdkConnected.tsx index b80258bf0f5e..cf40151719b7 100644 --- a/frontend/src/component/onboarding/dialog/SdkConnected.tsx +++ b/frontend/src/component/onboarding/dialog/SdkConnected.tsx @@ -45,9 +45,9 @@ export const SdkConnected: FC = ({ sdk }) => { Production settings - In order to validate the connection, we changed some - settings that you might want to revert. We recommend the - following default settings. + We updated the Unleash code snippet to be production-ready. + We recommend applying the following new settings to avoid + exposing the API key and to follow best practices. {productionSnippet} diff --git a/frontend/src/component/onboarding/dialog/snippets/flutter.md b/frontend/src/component/onboarding/dialog/snippets/flutter.md index 43bea5e18be4..76ab182e9cdf 100644 --- a/frontend/src/component/onboarding/dialog/snippets/flutter.md +++ b/frontend/src/component/onboarding/dialog/snippets/flutter.md @@ -20,3 +20,21 @@ Timer.periodic(Duration(seconds: 1), (Timer timer) { print('Flag is ${unleash.isEnabled("") ? "enabled" : "disabled"}'); }); ``` +--- +```dart +import 'package:unleash_proxy_client_flutter/unleash_proxy_client_flutter.dart'; +import 'dart:async'; +import 'dart:io'; + +final unleash = UnleashClient( + url: Uri.parse(''), + clientKey: Platform.environment['UNLEASH_CLIENT_KEY']!, + appName: 'unleash-onboarding-flutter'); + +unleash.start(); +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash_proxy_client_flutter) +- [Flutter example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Flutter) +- [A/B Testing in Flutter using Unleash and Mixpanel](https://docs.getunleash.io/feature-flag-tutorials/flutter/a-b-testing) diff --git a/frontend/src/component/onboarding/dialog/snippets/go.md b/frontend/src/component/onboarding/dialog/snippets/go.md index 63170c00cf5f..b59f8175ee51 100644 --- a/frontend/src/component/onboarding/dialog/snippets/go.md +++ b/frontend/src/component/onboarding/dialog/snippets/go.md @@ -28,3 +28,27 @@ func main() { } } ``` + +--- +```go +import ( + "github.com/Unleash/unleash-client-go/v3" + "net/http" + "time" +) + +func init() { + unleash.Initialize( + unleash.WithListener(&unleash.DebugListener{}), + unleash.WithAppName("unleash-onboarding-golang"), + unleash.WithUrl(""), + unleash.WithCustomHeaders(http.Header{ + "Authorization": {os.Getenv("UNLEASH_API_KEY")}, + }) + ) +} +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-go) +- [Go SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Go) diff --git a/frontend/src/component/onboarding/dialog/snippets/java.md b/frontend/src/component/onboarding/dialog/snippets/java.md index ed41182a6f67..a0df9e56d96a 100644 --- a/frontend/src/component/onboarding/dialog/snippets/java.md +++ b/frontend/src/component/onboarding/dialog/snippets/java.md @@ -25,3 +25,18 @@ while (true) { Thread.sleep(1000); } ``` + +--- +```java +UnleashConfig config = UnleashConfig.builder() + .appName("unleash-onboarding-java") + .instanceId("unleash-onboarding-instance") + .unleashAPI("") + .apiKey(System.getenv("UNLEASH_API_KEY")) + .build(); +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-java) +- [Java SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Java) +- [How to Implement Feature Flags in Java](https://docs.getunleash.io/feature-flag-tutorials/java) diff --git a/frontend/src/component/onboarding/dialog/snippets/javascript.md b/frontend/src/component/onboarding/dialog/snippets/javascript.md index d575ebfbef43..8f68dce50a7b 100644 --- a/frontend/src/component/onboarding/dialog/snippets/javascript.md +++ b/frontend/src/component/onboarding/dialog/snippets/javascript.md @@ -20,3 +20,16 @@ setInterval(() => { console.log('Is enabled', unleash.isEnabled('')); }, 1000); ``` +--- +```js +const unleash = new UnleashClient({ + url: '', + clientKey: process.env.UNLEASH_API_TOKEN, + appName: 'unleash-onboarding-javascript', +}); +unleash.start(); +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-proxy-client-js) +- [JavaScript SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/JavaScript) diff --git a/frontend/src/component/onboarding/dialog/snippets/nodejs.md b/frontend/src/component/onboarding/dialog/snippets/nodejs.md index 5ea2523b1ed0..2580de4e5342 100644 --- a/frontend/src/component/onboarding/dialog/snippets/nodejs.md +++ b/frontend/src/component/onboarding/dialog/snippets/nodejs.md @@ -32,5 +32,5 @@ const unleash = initialize({ --- - [SDK repository with documentation](https://github.com/Unleash/unleash-client-node) -- [Node.js SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/JavaScript) +- [Node.js SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/NodeJS) - [Node.js SDK tutorial](https://dev.to/reeshee/how-to-implement-feature-flags-in-nodejs-using-unleash-3907) diff --git a/frontend/src/component/onboarding/dialog/snippets/php.md b/frontend/src/component/onboarding/dialog/snippets/php.md index 636a7fa1b361..120ce6637ae1 100644 --- a/frontend/src/component/onboarding/dialog/snippets/php.md +++ b/frontend/src/component/onboarding/dialog/snippets/php.md @@ -24,3 +24,16 @@ while (true) { sleep(1); } ``` +--- +```php +$unleash = UnleashBuilder::create() + ->withAppName('unleash-onboarding-php') + ->withAppUrl('') + ->withHeader('Authorization', getenv('UNLEASH_API_TOKEN')) + ->withInstanceId('unleash-onboarding-instance') + ->build(); +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-php) +- [PHP SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/PHP) diff --git a/frontend/src/component/onboarding/dialog/snippets/python.md b/frontend/src/component/onboarding/dialog/snippets/python.md index a1f57952c830..b7ab7b1c2e17 100644 --- a/frontend/src/component/onboarding/dialog/snippets/python.md +++ b/frontend/src/component/onboarding/dialog/snippets/python.md @@ -20,3 +20,19 @@ while True: print(client.is_enabled("")) asyncio.run(asyncio.sleep(1)) ``` +--- +```python +from UnleashClient import UnleashClient +import asyncio +import os + +client = UnleashClient( + url="", + app_name="unleash-onboarding-python", + custom_headers={'Authorization': os.getenv('UNLEASH_API_TOKEN')} +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-python) +- [Python SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Python) +- [How to Implement Feature Flags in Python](https://docs.getunleash.io/feature-flag-tutorials/python) diff --git a/frontend/src/component/onboarding/dialog/snippets/react.md b/frontend/src/component/onboarding/dialog/snippets/react.md index f78bc46308f3..7f6cbc43ef37 100644 --- a/frontend/src/component/onboarding/dialog/snippets/react.md +++ b/frontend/src/component/onboarding/dialog/snippets/react.md @@ -36,3 +36,17 @@ const TestComponent = () => { return enabled ? 'Flag is enabled' : 'Flag is disabled' }; ``` +--- +```jsx +const config = { + url: '', + clientKey: process.env.UNLEASH_API_TOKEN, + appName: 'unleash-onboarding-react', +}; +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/proxy-client-react) +- [React SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/React) +- [https://docs.getunleash.io/feature-flag-tutorials/react](https://docs.getunleash.io/feature-flag-tutorials/react) + diff --git a/frontend/src/component/onboarding/dialog/snippets/ruby.md b/frontend/src/component/onboarding/dialog/snippets/ruby.md index fac0eadd527c..54d4d3d8e99e 100644 --- a/frontend/src/component/onboarding/dialog/snippets/ruby.md +++ b/frontend/src/component/onboarding/dialog/snippets/ruby.md @@ -12,7 +12,6 @@ require 'unleash' custom_http_headers: { 'Authorization': "" }, app_name: 'unleash-onboarding-ruby', instance_id: 'unleash-onboarding-ruby', - refresh_interval: 3, # In production use interval of >15s metrics_interval: 3, # In production use interval of >15s ) @@ -26,3 +25,17 @@ while true end ``` +--- +```rb +@unleash = Unleash::Client.new( + url: "", + custom_http_headers: { 'Authorization': ENV['UNLEASH_API_TOKEN'] }, + app_name: 'unleash-onboarding-ruby', + instance_id: 'unleash-onboarding-ruby', +) +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-ruby) +- [Ruby example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Ruby) +- [How to Implement Feature Flags in Ruby](https://docs.getunleash.io/feature-flag-tutorials/ruby) diff --git a/frontend/src/component/onboarding/dialog/snippets/rust.md b/frontend/src/component/onboarding/dialog/snippets/rust.md index de2ab1b34628..4ee8646a7291 100644 --- a/frontend/src/component/onboarding/dialog/snippets/rust.md +++ b/frontend/src/component/onboarding/dialog/snippets/rust.md @@ -50,3 +50,22 @@ async fn main() -> Result<(), Box> { Ok(()) } ``` +--- +```rust +let api_token = env::var("UNLEASH_API_TOKEN").expect("UNLEASH_API_TOKEN environment variable not set"); + +let client: Client = ClientBuilder::default() + .interval(5000) // Polling & metrics interval - default 15000 (ms) + .into_client( + "", + "unleash-onboarding-rust", + "unleash-onboarding-instance", + Some(api_token.to_owned()), + )?; +client.register().await?; +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/unleash-client-rust) +- [Rust example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Rust) +- [How to Implement Feature Flags in Rust](https://docs.getunleash.io/feature-flag-tutorials/rust) diff --git a/frontend/src/component/onboarding/dialog/snippets/svelte.md b/frontend/src/component/onboarding/dialog/snippets/svelte.md index edf27198190d..f19dcb990d79 100644 --- a/frontend/src/component/onboarding/dialog/snippets/svelte.md +++ b/frontend/src/component/onboarding/dialog/snippets/svelte.md @@ -11,8 +11,7 @@ npm install @unleash/proxy-client-svelte const config = { url: '', clientKey: '', - appName: 'unleash-onboarding-svelte' - refreshInterval: 5, + appName: 'unleash-onboarding-svelte', metricsInterval: 5, }; @@ -39,3 +38,16 @@ npm install @unleash/proxy-client-svelte

``` +--- +```svelte +const config = { + url: '', + clientKey: import.meta.env.VITE_UNLEASH_API_TOKEN, + appName: 'unleash-onboarding-svelte', +}; +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/proxy-client-svelte) +- [Svelte example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Svelte) +- [How to Implement Feature Flags in SvelteKit](https://docs.getunleash.io/feature-flag-tutorials/sveltekit) diff --git a/frontend/src/component/onboarding/dialog/snippets/vue.md b/frontend/src/component/onboarding/dialog/snippets/vue.md index 87b5bee36bce..7e559a899c62 100644 --- a/frontend/src/component/onboarding/dialog/snippets/vue.md +++ b/frontend/src/component/onboarding/dialog/snippets/vue.md @@ -12,7 +12,6 @@ npm install @unleash/proxy-client-vue url: '', clientKey: '', appName: 'unleash-onboarding-vue', - refreshInterval: 5, metricsInterval: 5, } @@ -37,3 +36,15 @@ npm install @unleash/proxy-client-vue ``` +--- +```svelte +const config = { + url: '', + clientKey: import.meta.env.VITE_UNLEASH_API_TOKEN, + appName: 'unleash-onboarding-vue', +} +``` + +--- +- [SDK repository with documentation](https://github.com/Unleash/proxy-client-vue) +- [Vue example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Vue)