← back to Dw Signup Fulfillment

.env.example

82 lines

# dw-signup-fulfillment — environment. Copy to .env and fill for go-live.
# .env is gitignored. NEVER commit real tokens.

# --- Safety switch --------------------------------------------------------
# DRY_RUN defaults ON. Only the literal 0 / false / no disables it, so a missing
# or malformed value can NEVER accidentally arm live writes. Keep this 1 until
# you have followed DEPLOY.md end-to-end.
DRY_RUN=1

# --- Service --------------------------------------------------------------
PORT=9856

# --- Shopify Admin API ----------------------------------------------------
SHOP_DOMAIN=designer-laboratory-sandbox.myshopify.com
SHOPIFY_API_VERSION=2024-10

# The fulfillment token. It needs: write_customers, write_gift_cards,
# write_discounts, write_price_rules, read_customers, plus read/write webhooks.
# It can be set to the SHOPIFY_DRAFT_TOKEN value from
# ~/Projects/secrets-manager/.env (that token ends a43b and already carries all
# 139 of those scopes). The service reads it via config.js from the secrets
# master if this is left blank, but prefer setting it explicitly here.
SHOPIFY_FULFILLMENT_TOKEN=

# Shopify signs each webhook body with this secret (X-Shopify-Hmac-Sha256).
# You get it from the webhook registration response / the app's webhook settings.
SHOPIFY_WEBHOOK_SECRET=

# --- Retail sample economics ---------------------------------------------
# The WIRED retail path issues a UNIQUE single-use CODE per new customer, backed by
# the "DW Free Samples" Discount FUNCTION (samples-only, first N free). FREE_SAMPLE_COUNT
# is the freebie cap the function enforces; SAMPLE_PRICE is informational here.
FREE_SAMPLE_COUNT=3
SAMPLE_PRICE=4.25
CURRENCY=USD

# --- Discount FUNCTION id (REQUIRED for retail at go-live) -----------------
# The id of the deployed "DW Free Samples" Discount Function that the per-customer
# CODE discount references (discountCodeAppCreate.functionId). Deploy the function
# ONCE and read its id:
#   cd ~/Projects/Designer-Wallcoverings/shopify/staged/free-samples-function
#   shopify app config link && shopify app deploy
#   # then: GraphQL  query { shopifyFunctions(first:25){ nodes{ id title apiType } } }
#   # copy the id whose title == "DW Free Samples" (apiType discount) here.
# Unset in DRY_RUN → the service still simulates but logs a WARN. It is REQUIRED
# before flipping DRY_RUN=0 (Shopify rejects a code discount with no functionId).
DISCOUNT_FUNCTION_ID=

# Only used by the ALTERNATE lib/giftcode-discount.js path (NOT wired) — scoping a
# 100%-off code to a Samples collection. Leave blank unless you deliberately switch
# to that alternate at go-live.
SAMPLES_COLLECTION_ID=

# --- George email (:9850) -------------------------------------------------
GEORGE_URL=http://127.0.0.1:9850
GEORGE_ACCOUNT=steve-office
GEORGE_FROM=steve@designerwallcoverings.com
# These are normally resolved automatically from ~/Projects/george-gmail/.env
# (Mac) or ~/DW-Agents/gmail-agent/.env (Kamatera). Override here only if needed.
# GEORGE_EXTERNAL_SEND_TOKEN=
# GEORGE_BASIC_AUTH=admin:

# --- Admin review surface (basic-auth) ------------------------------------
ADMIN_USER=admin
ADMIN_PASS=DW2024!

# Retail: the exact code of the admin-created "DW Free Samples" discount (shared, one-use-per-customer).
# Must match the code you set in Shopify admin (e.g. DWSAMPLES3). Required for retail emails.
RETAIL_SHARED_CODE=

# --- Public webhook hardening (mint endpoint is public + secret-less) -------
# URL-token auth: register the Shopify webhook at
#   POST $PUBLIC_URL/webhooks/customers/create/<WEBHOOK_URL_TOKEN>
# Generate: openssl rand -hex 24. If unset, the webhook 503s when live (DRY_RUN dev only runs open).
WEBHOOK_URL_TOKEN=
# Only gift customers created within this many minutes (blocks minting to the existing base). Default 1440 (24h).
WEBHOOK_FRESHNESS_MIN=1440
# Max webhook POSTs accepted per IP per minute.
WEBHOOK_RATE_MAX=30
# Hard cap on gift cards minted per UTC day (money backstop).
MINT_DAILY_CAP=200