Fix prod api url

This commit is contained in:
pikiou 2021-11-30 16:09:36 +01:00
parent a84c329040
commit 6541de5ff9
7 changed files with 11 additions and 6 deletions

View File

@ -55,5 +55,6 @@ module.exports = {
__CLIENT__: true,
__SERVER__: true,
__DEV__: true,
__LOCAL__: false,
},
}

View File

@ -21,6 +21,7 @@ module.exports = {
__DEV__: true,
__CLIENT__: true,
__SERVER__: false,
__LOCAL__: false,
},
maxConcurrency: 50,
maxWorkers: 1,

View File

@ -41,9 +41,9 @@
"scripts": {
"dev": "yarn dev:build && nodemon ./public/server",
"dev:build": "cross-env NODE_ENV=development webpack --config ./webpack/server.config.ts",
"local-start": "cross-env INTRANET_HOST=localhost node ./public/server",
"local-start": "cross-env LOCAL=true node ./public/server",
"start": "node ./public/server",
"local-build": "cross-env INTRANET_HOST=localhost run-s build:*",
"local-build": "cross-env LOCAL=true run-s build:*",
"build": "run-s build:*",
"build:server": "cross-env NODE_ENV=production webpack --config ./webpack/server.config.ts",
"build:client": "cross-env NODE_ENV=production webpack --config ./webpack/client.config.ts",

View File

@ -1,9 +1,8 @@
const PORT = 4000
const HOST =
__SERVER__ && !__DEV__ ? process.env.INTRANET_HOST || "fo.parisestludique.fr" : "localhost"
const API_URL = __DEV__ || __LOCAL__ ? `http://localhost:${PORT}` : "https://fo.parisestludique.fr"
export default {
PORT,
HOST: "0.0.0.0",
API_URL: `http://${HOST}:${PORT}`,
API_URL,
}

View File

@ -52,7 +52,7 @@ async function getSecret() {
export async function getJwt(email: string): Promise<string> {
const jwt = sign({ user: canonicalEmail(email), permissions: [] }, await getSecret(), {
expiresIn: "7d",
expiresIn: "365d",
})
return jwt
}

View File

@ -1,6 +1,7 @@
declare const __CLIENT__: boolean
declare const __SERVER__: boolean
declare const __DEV__: boolean
declare const __LOCAL__: boolean
declare module "*.svg"
declare module "*.gif"
@ -16,6 +17,7 @@ declare namespace NodeJS {
__CLIENT__: boolean
__SERVER__: boolean
__DEV__: boolean
__LOCAL__: boolean
$RefreshReg$: () => void
$RefreshSig$$: () => void
}

View File

@ -8,6 +8,7 @@ import LoadablePlugin from "@loadable/webpack-plugin"
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"
export const isDev = process.env.NODE_ENV === "development"
const isLocal = process.env.LOCAL === "true"
const getStyleLoaders = (isWeb: boolean, isSass?: boolean) => {
let loaders: RuleSetUseItem[] = [
{
@ -47,6 +48,7 @@ const getPlugins = (isWeb: boolean) => {
__CLIENT__: isWeb,
__SERVER__: !isWeb,
__DEV__: isDev,
__LOCAL__: isLocal,
}),
]