Skip to content

Add environment variable support for cache engine (Redis)#2

Merged
mguptahub merged 1 commit into
mainfrom
env-var-config
May 27, 2026
Merged

Add environment variable support for cache engine (Redis)#2
mguptahub merged 1 commit into
mainfrom
env-var-config

Conversation

@mguptahub

Copy link
Copy Markdown

Summary

  • Extends config.loader.js to apply IFRAMELY_* env vars as a final override layer on top of file-based config
  • Redis connection options are only built when the effective engine resolves to redis — no accidental injection when using node-cache or other engines
  • Updates docker-compose.yml with a bundled Redis service for local testing, with healthcheck and depends_on ordering

Environment variables

Variable Values Description
IFRAMELY_CACHE_ENGINE redis | node-cache | memcached | no-cache Cache engine selection
IFRAMELY_CACHE_TTL integer (seconds) Cache TTL
IFRAMELY_REDIS_HOST hostname / IP Redis host
IFRAMELY_REDIS_PORT integer Redis port
IFRAMELY_REDIS_PASSWORD string Redis auth password
IFRAMELY_REDIS_TLS true | false Enable TLS socket
IFRAMELY_REDIS_MODE standard | cluster Redis topology mode

Test plan

  • Built image locally — docker compose build succeeded
  • Brought up stack with docker compose up -d — iframely + Redis both healthy
  • Logs confirm Using cache engine: redis and local whitelist loaded (1886 domains, no external calls)
  • Smoke tested GET /iframely?url=https://github.com — valid response returned
  • Confirmed redis-cli keys "*" shows meta:https://github.com cached in Redis after first request

Co-authored-by: Plane AI noreply@plane.so

Extends config.loader.js to apply IFRAMELY_* env vars as a final override
layer on top of file-based config, enabling container deployments to configure
the cache engine and Redis connection without mounting a config.local.js file.

Supported variables:
  IFRAMELY_CACHE_ENGINE   redis | node-cache | memcached | no-cache
  IFRAMELY_CACHE_TTL      cache TTL in seconds
  IFRAMELY_REDIS_HOST     Redis hostname or IP
  IFRAMELY_REDIS_PORT     Redis port
  IFRAMELY_REDIS_PASSWORD Redis auth password
  IFRAMELY_REDIS_TLS      true to enable TLS socket
  IFRAMELY_REDIS_MODE     standard | cluster

Redis connection options are only applied when the effective cache engine
resolves to redis (from env var or file config), preventing accidental
REDIS_OPTIONS injection when a different engine is in use.

Also updates docker-compose.yml with a Redis service for local testing,
with a healthcheck and depends_on so iframely only starts once Redis is ready.

Co-authored-by: Plane AI <noreply@plane.so>
@mguptahub mguptahub merged commit a991333 into main May 27, 2026
@mguptahub mguptahub deleted the env-var-config branch May 27, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant