Stormkit LogoStormkit Logo WhiteStormkit

Remote configuration

It's easy to configure your application remotely on Stormkit. All you have to do is to head on the environment page, click on the Remote Config link and provide key-value pairs.Remote Config

You can access these settings in your code by using our open source @stormkit/apipackage.

Here's an example:import React from "react"; import sk from "@stormkit/api"; const App = () => { // Here `enablePromotions` is the name of the key specified in the // remote configuration page, with a `boolean` type selected. if (sk.config().enablePromotions === true) { return <div>25% discount</div> } return <div>Full price</div> } export default App;

Server side

If you're using server side rendering and you need to access the config on the server, make sure to provide the request object. This argument will be ignored on the client side, therefore the following example is an isomorphic example.import React from "react"; import sk from "@stormkit/api"; // Here the `req` property is injected somewhere in server entry file. // This is required, otherwise on the server side Stormkit won't be able // to read the headers and understand the configuration. const App = ({ req }) => { if (sk.config(req).enablePromotions === true) { return <div>25% discount</div> } return <div>Full price</div> } export default App;

Configuration structure

You can pass a string, boolean or a number from the configuration. Simply specify the type from the dropdown on the Remote Configuration page. If you specify the same key name multiple times, the values will be aggregated in an array.

Warning: this is not a replacement for a CMS

Please be aware that this is not a replacement for a headless CMS. It's purely intended for configuring your application, not managing the content. This config will be passed to your application with each request. Therefore, make sure to keep it as small as possible to reduce the response size.