mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
feat(onboarding): add comments to snippets (#8361)
Add warning about plaintext API key and increased metrics interval
This commit is contained in:
parent
52b7e235fd
commit
d760af321f
@ -18,10 +18,10 @@ public class Program
|
||||
{
|
||||
AppName = "unleash-onboarding-dotnet",
|
||||
UnleashApi = new Uri("<YOUR_API_URL>"),
|
||||
SendMetricsInterval = TimeSpan.FromSeconds(1),
|
||||
SendMetricsInterval = TimeSpan.FromSeconds(1), // in production remove this or increase to >=15s
|
||||
CustomHttpHeaders = new Dictionary<string, string>()
|
||||
{
|
||||
{"Authorization","<YOUR_API_TOKEN>"}
|
||||
{"Authorization","<YOUR_API_TOKEN>"} // in production use environment variable
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@ import 'dart:async';
|
||||
|
||||
final unleash = UnleashClient(
|
||||
url: Uri.parse('<YOUR_API_URL>'),
|
||||
clientKey: '<YOUR_API_TOKEN>',
|
||||
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
||||
appName: 'unleash-onboarding-flutter');
|
||||
|
||||
unleash.start();
|
||||
|
@ -18,8 +18,8 @@ func init() {
|
||||
unleash.WithListener(&unleash.DebugListener{}),
|
||||
unleash.WithAppName("unleash-onboarding-golang"),
|
||||
unleash.WithUrl("<YOUR_API_URL>"),
|
||||
unleash.WithCustomHeaders(http.Header{"Authorization": {"<YOUR_API_TOKEN>"}}),
|
||||
unleash.WithMetricsInterval(1*time.Second),
|
||||
unleash.WithCustomHeaders(http.Header{"Authorization": {"<YOUR_API_TOKEN>"}}), // in production use environment variable
|
||||
unleash.WithMetricsInterval(1*time.Second), // in production remove this or increase to >=15s
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ UnleashConfig config = UnleashConfig.builder()
|
||||
.appName("unleash-onboarding-java")
|
||||
.instanceId("unleash-onboarding-instance")
|
||||
.unleashAPI("<YOUR_API_URL>")
|
||||
.apiKey("<YOUR_API_TOKEN>")
|
||||
.sendMetricsInterval(1)
|
||||
.apiKey("<YOUR_API_TOKEN>") // in production use environment variable
|
||||
.sendMetricsInterval(1) // in production remove this or increase to >=15
|
||||
.build();
|
||||
|
||||
Unleash unleash = new DefaultUnleash(config);
|
||||
|
@ -9,9 +9,9 @@ const { UnleashClient } = require('unleash-proxy-client');
|
||||
|
||||
const unleash = new UnleashClient({
|
||||
url: '<YOUR_API_URL>',
|
||||
clientKey: '<YOUR_API_TOKEN>',
|
||||
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
||||
appName: 'unleash-onboarding-javascript',
|
||||
metricsInterval: 1000,
|
||||
metricsInterval: 1000, // in production remove this or increase to >=15000
|
||||
});
|
||||
|
||||
unleash.start();
|
||||
|
@ -10,8 +10,10 @@ const { initialize } = require('unleash-client');
|
||||
const unleash = initialize({
|
||||
url: '<YOUR_API_URL>',
|
||||
appName: 'unleash-onboarding-node',
|
||||
customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
|
||||
metricsInterval: 1000,
|
||||
customHeaders: {
|
||||
Authorization: '<YOUR_API_TOKEN>' // in production use environment variable
|
||||
},
|
||||
metricsInterval: 1000, // in production remove this or increase to >=15000
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
|
@ -14,9 +14,9 @@ require 'vendor/autoload.php';
|
||||
$unleash = UnleashBuilder::create()
|
||||
->withAppName('unleash-onboarding-php')
|
||||
->withAppUrl('<YOUR_API_URL>')
|
||||
->withHeader('Authorization', '<YOUR_API_TOKEN>')
|
||||
->withHeader('Authorization', '<YOUR_API_TOKEN>') // in production use environment variable
|
||||
->withInstanceId('unleash-onboarding-instance')
|
||||
->withMetricsInterval(1000)
|
||||
->withMetricsInterval(1000) // in production remove this or increase to >=15000
|
||||
->build();
|
||||
|
||||
while (true) {
|
||||
|
@ -11,8 +11,8 @@ import asyncio
|
||||
client = UnleashClient(
|
||||
url="<YOUR_API_URL>",
|
||||
app_name="unleash-onboarding-python",
|
||||
metrics_interval=1,
|
||||
custom_headers={'Authorization': '<YOUR_API_TOKEN>'})
|
||||
metrics_interval=1, # in production remove this or increase to >=15
|
||||
custom_headers={'Authorization': '<YOUR_API_TOKEN>'}) # in production use environment variable
|
||||
|
||||
client.initialize_client()
|
||||
|
||||
|
@ -10,7 +10,7 @@ import { FlagProvider } from '@unleash/proxy-client-react';
|
||||
|
||||
const config = {
|
||||
url: '<YOUR_API_URL>',
|
||||
clientKey: '<YOUR_API_TOKEN>',
|
||||
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
||||
metricsInterval: 1, // In production use interval of >15s
|
||||
appName: 'unleash-onboarding-react',
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ require 'unleash'
|
||||
|
||||
@unleash = Unleash::Client.new(
|
||||
url: "<YOUR_API_URL>",
|
||||
custom_http_headers: { 'Authorization': "<YOUR_API_TOKEN>" },
|
||||
custom_http_headers: { 'Authorization': "<YOUR_API_TOKEN>" }, # in production use environment variable
|
||||
app_name: 'unleash-onboarding-ruby',
|
||||
instance_id: 'unleash-onboarding-ruby',
|
||||
metrics_interval: 3, # In production use interval of >15s
|
||||
|
@ -26,12 +26,12 @@ enum Flags {
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
let client: Client<Flags, reqwest::Client> = ClientBuilder::default()
|
||||
.interval(1000) // Polling & metrics interval - default 15000 (ms)
|
||||
.interval(1000) // in production remove this or increase to >=15000
|
||||
.into_client(
|
||||
"<YOUR_API_URL>",
|
||||
"unleash-onboarding-rust",
|
||||
"unleash-onboarding-instance",
|
||||
Some("<YOUR_API_TOKEN>".to_owned()),
|
||||
Some("<YOUR_API_TOKEN>".to_owned()), // in production use environment variable
|
||||
)?;
|
||||
client.register().await?;
|
||||
|
||||
|
@ -10,9 +10,9 @@ npm install @unleash/proxy-client-svelte
|
||||
|
||||
const config = {
|
||||
url: '<YOUR_API_URL>',
|
||||
clientKey: '<YOUR_API_TOKEN>',
|
||||
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
||||
appName: 'unleash-onboarding-svelte',
|
||||
metricsInterval: 1,
|
||||
metricsInterval: 1, // in production remove this or increase to >=15
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -11,8 +11,8 @@ import UnleashProxyClientSwift
|
||||
|
||||
var unleash = UnleashProxyClientSwift.UnleashClient(
|
||||
unleashUrl: "<YOUR_API_URL>",
|
||||
clientKey: "<YOUR_API_TOKEN>",
|
||||
refreshInterval: 5,
|
||||
clientKey: "<YOUR_API_TOKEN>", // in production use environment variable
|
||||
refreshInterval: 5, // in production remove this or increase to >=5
|
||||
appName: "unleash-onboarding-swift",
|
||||
context: [:])
|
||||
|
||||
|
@ -10,9 +10,9 @@ npm install @unleash/proxy-client-vue
|
||||
|
||||
const config = {
|
||||
url: '<YOUR_API_URL>',
|
||||
clientKey: '<YOUR_API_TOKEN>',
|
||||
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
||||
appName: 'unleash-onboarding-vue',
|
||||
metricsInterval: 1,
|
||||
metricsInterval: 1, // in production remove this or increase to >=15
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user