Since version 3.6
Maintenance Mode
You may want to put one or more of your stores in maintenance mode while you do some maintenance work/deployment tasks on your store(s).
Front-Commerce comes with an API that allows you to put/remove a store in
maintenance mode. To enable the maintenance mode API you need to set the
FRONT_COMMERCE_MAINTENANCE_MODE_AUTHORIZATION_TOKEN
environment variable.
FRONT_COMMERCE_MAINTENANCE_MODE_AUTHORIZATION_TOKEN=a-secret-token
Once you have setup the FRONT_COMMERCE_MAINTENANCE_MODE_AUTHORIZATION_TOKEN
environment variable the maintenance mode API will be available after restarting
the server
The Maintenance Mode API
Bypassing the maintenance mode
To bypass the maintenance mode for certain IP addresses you can configure the
maintenance.authorizedIps
in your front-commerce.config.ts
file.
import { defineConfig } from "@front-commerce/core";
export default defineConfig({
maintenance: {
authorizedIps: ["127.0.0.1", "83.65.12.111", "2ce8:c427::7156:ad8e"],
},
});
Please configure both v4 and v6 IP as much as possible.
To retrieve your IP address you can use https://www.whatismyip.com/ or via the curl command:
$ curl ifconfig.me -6
# 2ce8:c427::7156:ad8e
$ curl ifconfig.me -4
# 83.65.12.111