environment.js 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
// This file is used to generate environment variables which used by the app

// PUBLIC_PATH is for assets, can be set to a CDN address
process.env.SNOWPACK_PUBLIC_PATH = process.env.CDN_VERSION
    ? `https://visualdl-static.cdn.bcebos.com/assets/${process.env.CDN_VERSION}`
    : process.env.PUBLIC_PATH === '/' || !process.env.PUBLIC_PATH
    ? ''
    : process.env.PUBLIC_PATH;

// BASE_URI is for env and router, must be local address which starts with a `/` or empty string
// if it is not set and PUBLIC_PATH is not a CDN address, it will be set to the same value of PUBLIC_PATH
process.env.SNOWPACK_PUBLIC_BASE_URI =
    process.env.SNOWPACK_PUBLIC_PATH.startsWith('/') || process.env.PUBLIC_PATH === ''
        ? process.env.SNOWPACK_PUBLIC_PATH
        : process.env.BASE_URI === '/' || !process.env.BASE_URI
        ? ''
        : process.env.BASE_URI;

// API_URL is for api requests
// it will be set to `${BASE_URI}/api` by default
// if it is set to a absolute address refer to another hostname, CORS headers must be set
process.env.SNOWPACK_PUBLIC_API_URL = process.env.API_URL || `${process.env.SNOWPACK_PUBLIC_BASE_URI}/api`;

// TELEMETRY_ID is for Baidu Tongji
// set to an empty string will disable telemetry
26
process.env.SNOWPACK_PUBLIC_TELEMETRY_ID = process.env.TELEMETRY_ID || '';
27 28 29

// API_TOKEN_KEY is for vdl-service
// if it is set, api requests will add an additional header `X-VisualDL-Instance-ID` from the token key in query string
30
process.env.SNOWPACK_PUBLIC_API_TOKEN_KEY = process.env.API_TOKEN_KEY || '';
31 32

// supported languages
33
process.env.SNOWPACK_PUBLIC_LANGUAGES = process.env.LANGUAGES || 'en,zh';
34
// default language
35
process.env.SNOWPACK_PUBLIC_DEFAULT_LANGUAGE = process.env.DEFAULT_LANGUAGE || 'en';
P
Peter Pan 已提交
36 37
// theme
process.env.SNOWPACK_PUBLIC_THEME = process.env.THEME || '';