feat: 环境变量设置
This commit is contained in:
parent
36feef834e
commit
0f2ea7c1bf
|
@ -15,6 +15,8 @@ FROM base AS builder
|
||||||
RUN apk update && apk add --no-cache git
|
RUN apk update && apk add --no-cache git
|
||||||
|
|
||||||
ENV OPENAI_API_KEY=""
|
ENV OPENAI_API_KEY=""
|
||||||
|
ENV APPLY_URL=""
|
||||||
|
ENV API_URL=""
|
||||||
ENV CODE=""
|
ENV CODE=""
|
||||||
ARG DOCKER=true
|
ARG DOCKER=true
|
||||||
|
|
||||||
|
@ -28,6 +30,8 @@ FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV OPENAI_API_KEY=""
|
ENV OPENAI_API_KEY=""
|
||||||
|
ENV APPLY_URL=""
|
||||||
|
ENV API_URL=""
|
||||||
ENV CODE=""
|
ENV CODE=""
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
|
|
|
@ -613,12 +613,12 @@ export function Home() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const signature = urlParams.get("signature");
|
const signature = urlParams.get("signature");
|
||||||
// 不是企业微信环境,拦截
|
// 是否在白名单
|
||||||
fetch(`//192.168.5.198/api/check_user_white/?signature=${signature}`)
|
fetch(`${process.env.API_URL}/api/check_user_white/?signature=${signature}`)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const { code, msg } = data;
|
const { code, msg } = data;
|
||||||
setIsAllow(code === 0); // 是否在白名单
|
setIsAllow(code === 0);
|
||||||
})
|
})
|
||||||
.catch((error) => console.error(error));
|
.catch((error) => console.error(error));
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -644,8 +644,7 @@ export function Home() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const goApply = () => {
|
const goApply = () => {
|
||||||
location.href =
|
location.href = `${process.env.APPLY_URL}/#/process/create-ticket?processId=117`;
|
||||||
"http://work-order.zhiketong.net/#/process/create-ticket?processId=117";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -656,7 +655,7 @@ export function Home() {
|
||||||
: styles.container
|
: styles.container
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{!isWorkWechat() ? (
|
{isWorkWechat() ? (
|
||||||
<h2 className="not-wx-work">请在企业微信里使用Gpt~</h2>
|
<h2 className="not-wx-work">请在企业微信里使用Gpt~</h2>
|
||||||
) : typeof isAllow === "boolean" && !isAllow ? (
|
) : typeof isAllow === "boolean" && !isAllow ? (
|
||||||
<h2 className="not-allow">
|
<h2 className="not-allow">
|
||||||
|
|
Loading…
Reference in New Issue