Skip to content

Commit

Permalink
环境配置
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhaomax committed Mar 20, 2024
1 parent e460a3e commit 5267f84
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import env from "../env/env.json"

const config = {
domain: env.prod.fe.domain,
beBaseUrl: env.run_mode === "prod" ?
beBaseUrl: process.env.NODE_ENV === "production" ?
`${env.prod.be.protocol}://${env.prod.be.domain}:${env.prod.be.port}` :
`${env.dev.be.protocol}://${env.dev.be.host}:${env.dev.be.port}`
}
Expand Down
1 change: 0 additions & 1 deletion client/src/env/env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"run_mode": "prod",
"prod": {
"fe": {
"protocol": "http",
Expand Down
3 changes: 1 addition & 2 deletions client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { createRoot } from "react-dom/client"
import "./index.css"
import App from "./app/App"
import { Provider } from "react-redux"
import env from "./env/env.json"
import axios from "axios"
import config from "./config/config"
import { _STORE } from "./state/store"

// https upgrading config
if (env.run_mode === "prod") {
if (process.env.NODE_ENV === "production") {
const head = document.getElementsByTagName("head")[0]
const https = document.createElement("meta")
https.setAttribute("http-equiv", "Content-Security-Policy")
Expand Down

0 comments on commit 5267f84

Please sign in to comment.