Configuration
Embetty's behavior is controlled by both client-side and server-side settings.
Client-Side Configuration
The frontend component needs to know the URL of your self-hosted embetty-server.
data-embetty-server Meta Tag
This is the primary method of configuration. Add a <meta> tag to the <head> of your HTML document.
<head>
<meta data-embetty-server="https://embetty.your-domain.com">
</head>
The component will use this URL to construct all API requests.
Server-Side Configuration
embetty-server is configured using environment variables. This is ideal for containerized deployments (like Docker) and modern cloud hosting.
| Variable | Required | Description |
|---|---|---|
URL_BASE |
No | The public base URL of the Embetty server instance, e.g., https://my-server.com/path/to/embetty. Used for generating URLs in AMP embeds. |
PORT |
No | The port on which the server listens. Defaults to 3000 if not set (or 8080 in the Dockerfile). |
VALID_ORIGINS |
Yes | A comma-separated list of allowed origins for CORS requests. This is a security measure to ensure only your websites can use your Embetty server. Use * to allow all origins (not recommended for production). |
TWITTER_BEARER_TOKEN |
If using tweets | Your Twitter API v2 Bearer Token. Required to fetch tweet data. |
EMBETTY_CACHE |
No | Connection string for the cache adapter. Defaults to an in-memory LRU cache. Supports Redis for distributed caching. Examples: redis://hostname:6379, lru://. |
DEBUG |
No | Controls log message output. Set to embetty.* to log all Embetty messages or * for all debug messages. |
Example Configuration (.env file)
When running locally, you can place these variables in a .env file in the embetty-server directory.
# The public URL of the website where Embetty components are used.
VALID_ORIGINS=http://localhost:3001,https://my-production-site.com
# Twitter API v2 Bearer Token (required for tweets)
TWITTER_BEARER_TOKEN=AAAAAAAAAAAAAAAAAAAAA... ... ...
# Optional: Use Redis for caching
EMBETTY_CACHE=redis://127.0.0.1:6379
# Optional: Run on a different port
PORT=8080
# Enable verbose logging for Embetty
DEBUG=embetty.*