What are product variables?
Product variables are key-value pairs stored per product. They allow you to store configuration data, API endpoints, server IPs, feature flags, and other dynamic values that your client application can fetch at runtime.
Example use cases
Game server IP, API version, feature toggles, update URLs, announcement messages, maintenance mode flags.
Creating variables
In the dashboard, navigate to App → Variables → [Select product] → Create variable.
Fields
namestring- Variable identifier (alphanumeric, case-insensitive). Example:
serverIp, apiVersion valuestring- String value. Example:
"192.168.1.100", "v2.3.1", "true"
Example variables
| Name | Value |
|---|
gameServerIp | "play.mygame.com:25565" |
api_endpoint | "https://api.example.com/v2" |
maintenanceMode | "false" |
welcome_message | "Welcome to the game!" |
Fetching variables
After authentication, fetch variables for a product with the C++ client:
C++Copy
Vaultix::VaultixClient client("https://vaultix.cc/api");
client.SetApiKey("ap_your_api_key");
// Authenticate first
if (client.AuthenticateWithKey(userKey)) {
std::string productId = "prod_xxxxxxxxxxxxx";
// Fetch all variables for the product (name/value pairs)
std::map<std::string, std::string> vars;
for (const auto& [name, value] : client.GetProductVariables(productId)) {
std::cout << name << " = " << value << std::endl;
vars[name] = value;
}
// Use a specific variable by name
std::cout << "Connecting to: " << vars["gameServerIp"] << std::endl;
// Check if a feature is switched on
if (vars["maintenanceMode"] == "true") {
std::cout << "Server is under maintenance. Please try again later." << std::endl;
return 1;
}
}
Common use cases
Server configuration
Store game server IPs, API endpoints, CDN URLs.
serverIpapiUrlcdnEndpoint
Feature flags
Enable/disable features without redeploying client.
new_ui_enabledbeta_features
Dynamic content
Messages, announcements, update URLs.
motdupdate_urlannouncement
Versioning
API versions, minimum client version requirements.
apiVersionmin_client_version
Variable rules and limitations
| Rule | Details |
|---|
| Names | Letters and numbers only (a-z, A-Z, 0-9). Case-insensitive. |
| Values | Stored as strings. Client must parse if needed (e.g., "true" → boolean). |
| Uniqueness | Variable names must be unique per product. |
| Access | All app users with product subscription can read variables. |
| Updates | Changes are immediate. Clients fetch latest values on each request. |
Example workflows
Maintenance mode
- Create variable:
maintenanceMode = "false" - Client fetches variable on startup
- When maintenance is needed, update via dashboard:
maintenanceMode = "true" - Next time clients start, they see maintenance mode enabled
- After maintenance, set back to
"false"
Server IP change
- Create variable:
serverIp = "old.server.com" - Clients connect using this IP
- Server migrates to new IP
- Update variable:
serverIp = "new.server.com" - Clients automatically connect to new IP (no client update needed)
Best practices
- Use descriptive names (e.g.,
gameServerIp not gsi) - Store sensitive data (like API keys) server-side, not in variables visible to clients
- Use boolean strings consistently (
"true"/"false", not "yes"/"no") - Cache variables client-side to reduce API calls, but refresh periodically
- Document what each variable controls in your internal docs
- Test variable changes in a staging environment before production