Marina R Albuquerque
Marina R Albuquerque

Reputation: 127

Get configurations from AppConfig

I've created an app, an evironment and a group of configurations (json) in appConfig. I'm using javascript, how can I get the configurations from appConfig in my code? I'm using Cloud9

Upvotes: 0

Views: 80

Answers (1)

Pierre Siza
Pierre Siza

Reputation: 5

If you are using Javascript/Typescript and want remote configurations in an easier (and I think cheaper) way than AppConfig, try getjoystick.com. We have used them. They have a really good management interface for your feature flags or full JSON configs. Team is also very responsive on Discord.

Here's how the code would look like. Basically three lines to get your config.

// Import the Joystick Remote Configuration package.
import { Joystick } from "@getjoystick/joystick-js";

// Initialize
const joystickClient = new Joystick({
    apiKey: "YOUR API KEY" // or process.env.JOYSTICK_API_KEY,
});

// Get the configuration from Joystick. What you get is already parsed.
const myConfig = await joystickClient.getContent("my-config");

console.log(myConfig);
    // Get full JSON feature flags / configs
    // {
    //    "color": "green",
    //    "size": 100,
    //    "bold": true,
    //    "text": "Use Remote Configuration!"
    // }

Full Javascript/Typescript docs here: https://docs.getjoystick.com/sdk-joystick-js/

Upvotes: 0

Related Questions