Remote config
Change balance, prices and feature flags without shipping an update. Every response is signed, verified on the device and cached for offline play.
Value types#
Create keys on the Remote config page. Values are stored as text with a type that tells the SDK how to read them:
| Type | Example | Limit |
|---|---|---|
string | Welcome back! | Up to 10,000 characters |
number | 25 | Any finite number |
boolean | false | true or false |
json | {"sale": 0.2} | Up to 50,000 bytes |
Read values#
Getters never fail: they return your fallback when a key is missing or does not convert.
int damage = Majacloud.RemoteConfig.GetInt("enemy_damage", 25);
float speed = Majacloud.RemoteConfig.GetFloat("player_speed", 4.5f);
bool maintenance = Majacloud.RemoteConfig.GetBool("maintenance_mode", false);
string welcome = Majacloud.RemoteConfig.GetString("welcome_message", "Hi!");
ShopConfig shop = Majacloud.RemoteConfig.GetJson<ShopConfig>("shop");var damage := Majacloud.remote_config.get_int("enemy_damage", 25)
var speed := Majacloud.remote_config.get_float("player_speed", 4.5)
var maintenance := Majacloud.remote_config.get_bool("maintenance_mode", false)
var welcome := Majacloud.remote_config.get_string("welcome_message", "Hi!")
var shop = Majacloud.remote_config.get_json("shop", {})const damage = mc.remoteConfig.getInt('enemy_damage', 25);
const speed = mc.remoteConfig.getNumber('player_speed', 4.5);
const maintenance = mc.remoteConfig.getBool('maintenance_mode', false);
const welcome = mc.remoteConfig.getString('welcome_message', 'Hi!');
const shop = mc.remoteConfig.getJson('shop', {});Fetch and updates#
Unity and Godot fetch the config when the game starts; on the web call fetch() yourself. Later fetches send the ETag, so an unchanged config costs one tiny 304 response.
Majacloud.RemoteConfig.ConfigUpdated += config => ApplyBalance();
var fetch = await Majacloud.RemoteConfig.FetchAsync(); // 304 when nothing changed
if (fetch.Ok) Debug.Log("Config v" + fetch.Value.Version + (fetch.Value.Changed ? " (new)" : ""));Majacloud.remote_config.updated.connect(apply_balance)
var fetch := await Majacloud.remote_config.fetch() # 304 when nothing changed
if fetch.ok:
print("Config v", fetch.value.version, " changed: ", fetch.value.changed)mc.remoteConfig.on('updated', () => applyBalance());
const fetch = await mc.remoteConfig.fetch(); // 304 when nothing changed
if (fetch.ok) console.log('Config v' + fetch.value.version, fetch.value.changed);curl -i https://majacloud.majanite.com/v1/config -H "X-Project-ID: $PROJECT_ID" -H "X-Client-Key: $CLIENT_KEY"
# Next time, send the ETag: 304 Not Modified when nothing changed
curl -i https://majacloud.majanite.com/v1/config -H "X-Project-ID: $PROJECT_ID" -H "X-Client-Key: $CLIENT_KEY" \
-H 'If-None-Match: "<etag>"'Offline and caching#
The last verified config is cached on the device and loaded at startup, so getters work offline and before the first fetch finishes. A fetch that fails because of the network keeps the cached copy; a config older than the cached one is rejected.
Signature verification#
data is the base64url payload, checksum its SHA-256 and signature an RSA-SHA256 signature over data, made with the private key in storage/keys/. The SDKs check all three, plus the project ID and version, before using a config.
| SDK | Where the public key comes from |
|---|---|
| Unity | Tools ▸ Majacloud ▸ Setup ▸ Test connection |
| Godot | Project ▸ Tools ▸ Majacloud: Test connection |
| Web | The configPublicKey option (the PEM on the API keys page) |
| REST | GET /v1/project → config_public_key_pem |
storage/keys/ in your backups: games pin its public key.You can verify a response yourself with OpenSSL:
# Verify a config response yourself (what every SDK does before using it)
curl -s https://majacloud.majanite.com/v1/project -H "X-Project-ID: $PROJECT_ID" -H "X-Client-Key: $CLIENT_KEY" | jq -r .project.config_public_key_pem > public.pem
curl -s https://majacloud.majanite.com/v1/config -H "X-Project-ID: $PROJECT_ID" -H "X-Client-Key: $CLIENT_KEY" > response.json
jq -j .data response.json > data.txt
jq -r .signature response.json | base64 --decode > signature.bin
openssl dgst -sha256 -verify public.pem -signature signature.bin data.txt # Verified OK
jq -r .data response.json | tr '_-' '/+' | base64 --decode 2>/dev/null | jq . # the payloadHistory and restore#
Every change is versioned. The dashboard keeps the history for 7 to 365 days depending on the plan and restores any earlier value with one click.