forked from 77media/video-flow
Merge branch 'feat-active-config' into dev
This commit is contained in:
commit
78c7bec590
@ -14,6 +14,21 @@ echo "Build process started at $(date)" | tee $LOGFILE
|
|||||||
# 获取当前分支名
|
# 获取当前分支名
|
||||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
# 指定并加载环境变量文件(dev 使用 .env.development)
|
||||||
|
ENV_FILE=".env.development"
|
||||||
|
if [ -f "$ENV_FILE" ]; then
|
||||||
|
echo "Loading environment from $ENV_FILE" | tee -a $LOGFILE
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
else
|
||||||
|
echo "未找到 $ENV_FILE,继续使用当前环境变量" | tee -a $LOGFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 设置 NODE_ENV 为 development,避免默认使用 production
|
||||||
|
export NODE_ENV="development"
|
||||||
|
|
||||||
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致
|
# 打包之前,需要检查是否在 dev 分支,工作区是否干净,是否和远程分支一致
|
||||||
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
|
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
|
||||||
echo "当前分支不是 dev 分支"
|
echo "当前分支不是 dev 分支"
|
||||||
|
|||||||
@ -14,6 +14,21 @@ echo "Build process started at $(date)" | tee $LOGFILE
|
|||||||
# 获取当前分支名
|
# 获取当前分支名
|
||||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
# 指定并加载环境变量文件(prod 使用 .env.production)
|
||||||
|
ENV_FILE=".env.production"
|
||||||
|
if [ -f "$ENV_FILE" ]; then
|
||||||
|
echo "Loading environment from $ENV_FILE" | tee -a $LOGFILE
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
else
|
||||||
|
echo "未找到 $ENV_FILE,继续使用当前环境变量" | tee -a $LOGFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 设置 NODE_ENV 为 production
|
||||||
|
export NODE_ENV="production"
|
||||||
|
|
||||||
# 打包之前,需要检查是否在 prod 分支,工作区是否干净,是否和远程分支一致
|
# 打包之前,需要检查是否在 prod 分支,工作区是否干净,是否和远程分支一致
|
||||||
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
|
if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then
|
||||||
echo "当前分支不是 prod 分支"
|
echo "当前分支不是 prod 分支"
|
||||||
|
|||||||
@ -17,7 +17,7 @@ export function useServerSetting<T = unknown>(code: string, defaultValue?: T) {
|
|||||||
dispatch(setLoading({ code, loading: true }));
|
dispatch(setLoading({ code, loading: true }));
|
||||||
try {
|
try {
|
||||||
const value = await fetchSettingByCode<T>(code, defaultValue as T | undefined);
|
const value = await fetchSettingByCode<T>(code, defaultValue as T | undefined);
|
||||||
dispatch(setValue<T>({ code, value: value as T }));
|
dispatch(setValue({ code, value: value }));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
dispatch(setError({ code, error: e?.message || 'Load failed' }));
|
dispatch(setError({ code, error: e?.message || 'Load failed' }));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export const serverSettingSlice = createSlice({
|
|||||||
const current = state.byCode[code] || {};
|
const current = state.byCode[code] || {};
|
||||||
state.byCode[code] = { ...current, loading, error: loading ? undefined : current.error };
|
state.byCode[code] = { ...current, loading, error: loading ? undefined : current.error };
|
||||||
},
|
},
|
||||||
setValue<T>(state, action: PayloadAction<{ code: string; value: T }>) {
|
setValue(state, action: PayloadAction<{ code: string; value: any }>) {
|
||||||
const { code, value } = action.payload as { code: string; value: unknown };
|
const { code, value } = action.payload as { code: string; value: unknown };
|
||||||
const current = state.byCode[code] || {};
|
const current = state.byCode[code] || {};
|
||||||
state.byCode[code] = { ...current, loading: false, error: undefined, value };
|
state.byCode[code] = { ...current, loading: false, error: undefined, value };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user