跳到主要内容

配置文件

Shoplazza CLI 使用 TOML 配置文件管理应用和扩展设置。

shoplazza.app.toml​

应用主配置文件,由 shoplazza app init 创建:

toml
client_id = "your-client-id"
partner_id = "your-partner-id"
scopes = "read_customer write_cart_transform"

[dashboard]
name = "My App"
app_url = "https://example.com"
redirect_url = "https://example.com/callback"
embed = true

多环境配置​

my-app/
├── shoplazza.app.toml # 默认配置
├── shoplazza.app.prod.toml # 生产环境
└── shoplazza.app.staging.toml # 预发布环境

切换配置:shoplazza app config use --config prod

只对单次 app dev、app deploy 或 app function release 指定配置、不切换:shoplazza app deploy --config prod

链接新配置:shoplazza app config link --client-id your-client-id

shoplazza.extension.toml​

每个扩展的独立配置:

toml
id = "extension-id"
name = "My Extension"
type = "theme" # theme / checkout / function

shoplazza.theme.toml​

主题项目可以在 shoplazza.theme.toml 中记录具名环境(店铺、主题 ID、路径、忽略规则、profile),并用 -e <name> 选择其一。见 themes env。

CLI 配置目录​

账号、profile 和凭证不保存在项目中,而是放在操作系统用户配置目录下的 shoplazza-cli 文件夹里(macOS 为 ~/Library/Application Support/shoplazza-cli,Linux 为 ~/.config/shoplazza-cli,Windows 为 %AppData%\shoplazza-cli):config.json 保存账号和 profile,令牌加密保存在同一目录下。

项目目录结构​

my-app/
├── shoplazza.app.toml
├── extensions/
│ ├── theme-extension/
│ ├── checkout-extension/
│ └── function-extension/
├── package.json
└── README.md