Skip to main content

Switching environments

Switching between environments in Neuroon boils down to two changes:

  1. The base URL your integration uses to call the API (api.neuroon.aidev-api.neuroon.ai).
  2. The key for the corresponding environment (sk_* and Widget Token).

All per-environment configuration must live in environment variables or secrets, never hardcoded.

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 Shop 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.10/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-api.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 Shop 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("X-Shop-API-Key", apiKey);

To switch to Development, change Neuroon:ApiBaseUrl to https://dev-api.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 Shop 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');

And allow filter override:

add_filter('neuroon_api_base_url', function($url) {
return defined('WP_ENV') && WP_ENV === 'staging'
? 'https://dev-api.neuroon.ai'
: '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/plugin/shops/${SHOP_ID}/products/sync`, {
method: 'POST',
headers: {
'X-Shop-API-Key': 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/plugin/shops/{SHOP_ID}/products/sync",
headers={"X-Shop-API-Key": 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.

Further reading