Switching environments
Switching between environments in Neuroon boils down to two changes:
- The base URL your integration uses to call the API (
api.neuroon.ai↔dev.neuroon.ai). - The key for the corresponding environment (
sk_*andWidget Token).
All per-environment configuration must live in environment variables or secrets, never hardcoded.
Recommended environment variables
NEUROON_API_URL=https://api.neuroon.ai
NEUROON_SHOP_ID=shop_xxxxxxxxxxxx
NEUROON_API_KEY=sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The Widget Token is not an env var — your own server signs it every 24 h with the API Key (HMAC). See Widget Token.
Per stack
HTML / widget <script> tag
Change the data-api-url attribute on the tag:
<script
src="https://cdn.neuroon.ai/widget@0.9.27/widget.js"
data-token="WIDGET_TOKEN_HERE"
data-container="#neuroon-search"
data-locale="es"
data-api-url="https://api.neuroon.ai"
async
></script>
For Development, replace with data-api-url="https://dev.neuroon.ai" and use the Widget Token issued in the Development Dashboard.
.NET (any framework: .NET 6+, ASP.NET Core, etc.)
Read the base URL and API Key from appsettings.{Environment}.json or environment variables:
// appsettings.Production.json
// {
// "Neuroon": {
// "ApiBaseUrl": "https://api.neuroon.ai",
// "ShopId": "shop_xxxxx",
// "ApiKey": "sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
// }
// }
var apiBase = builder.Configuration["Neuroon:ApiBaseUrl"]
?? "https://api.neuroon.ai";
var apiKey = builder.Configuration["Neuroon:ApiKey"]
?? throw new InvalidOperationException("Missing Neuroon:ApiKey");
using var http = new HttpClient { BaseAddress = new Uri(apiBase) };
http.DefaultRequestHeaders.Add("Authorization", apiKey);
To switch to Development, change Neuroon:ApiBaseUrl to https://dev.neuroon.ai and Neuroon:ApiKey to the Development sk_*. Do not store the Widget Token here — your server signs it every ~24 h with the API Key (HMAC). See Recipe · Server-to-server token.
WordPress (PHP)
Define in wp-config.php:
define('NEUROON_API_URL', 'https://api.neuroon.ai');
define('NEUROON_SHOP_ID', 'shop_xxxxxxxxxxxx');
define('NEUROON_API_KEY', 'sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
To switch automatically based on the environment, define the constant conditionally before the plugin loads (for example, in a mu-plugin or at the top of wp-config.php):
if (defined('WP_ENV') && WP_ENV === 'staging') {
define('NEUROON_API_URL', 'https://dev.neuroon.ai');
} else {
define('NEUROON_API_URL', 'https://api.neuroon.ai');
}
Custom Node.js / TypeScript
const NEUROON_API_URL = process.env.NEUROON_API_URL ?? 'https://api.neuroon.ai';
const NEUROON_API_KEY = process.env.NEUROON_API_KEY!;
await fetch(`${NEUROON_API_URL}/api/integrations/v1/products/sync`, {
method: 'POST',
headers: {
'Authorization': NEUROON_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
});
Custom Python
import os, requests
NEUROON_API_URL = os.environ.get("NEUROON_API_URL", "https://api.neuroon.ai")
NEUROON_API_KEY = os.environ["NEUROON_API_KEY"]
requests.post(
f"{NEUROON_API_URL}/api/integrations/v1/products/sync",
headers={"Authorization": NEUROON_API_KEY, "Content-Type": "application/json"},
json=payload,
timeout=30,
)
Golden rules
- Use distinct names for environment variables (
NEUROON_API_KEY_PROD,NEUROON_API_KEY_DEV) if your pipeline deploys both. - Audit your logs to detect requests with the wrong base URL before switching to Production.
- In containers, mount keys as orchestrator secrets (Docker secret, Kubernetes secret), not as a literal ENV in the
Dockerfile.