浏览代码

add .env support

Olivier Massot 4 年之前
父节点
当前提交
9cc9deda1c
共有 5 个文件被更改,包括 56 次插入8 次删除
  1. 15 0
      .env.local
  2. 14 0
      .env.preprod
  3. 14 0
      .env.prod
  4. 11 8
      config/nuxtConfig/env.js
  5. 2 0
      package.json

+ 15 - 0
.env.local

@@ -0,0 +1,15 @@
+## API Base Url
+SSR_API_BASE_URL=http://nginx_new
+CLIENT_API_BASE_URL=https://local.new.api.opentalent.fr
+
+# Legacy API Base Url
+SSR_APILEG_BASE_URL=http://nginx
+CLIENT_APILEG_BASE_URL=https://local.api.opentalent.fr
+
+# Legacy Admin Base Url
+SSR_ADMINLEG_BASE_URL=https://local.admin.opentalent.fr/#
+CLIENT_ADMINLEG_BASE_URL=https://local.admin.opentalent.fr/#
+
+# Typo3 Base Url
+SSR_TYPO3_BASE_URL=https://local.sub.opentalent.fr/###subDomain###
+CLIENT_TYPO3_BASE_URL=https://local.sub.opentalent.fr/###subDomain###

+ 14 - 0
.env.preprod

@@ -0,0 +1,14 @@
+## API Base Url
+SSR_API_BASE_URL = https://ap2i.preprod.opentalent.fr
+CLIENT_API_BASE_URL = https://ap2i.preprod.opentalent.fr
+
+# Legacy API Base Url
+SSR_APILEG_BASE_URL=https://api.preprod.opentalent.fr
+CLIENT_APILEG_BASE_URL=https://api.preprod.opentalent.fr
+
+# Legacy Admin Base Url
+SSR_ADMINLEG_BASE_URL=https://local.admin.opentalent.fr/#
+CLIENT_ADMINLEG_BASE_URL=https://local.admin.opentalent.fr/#
+
+# Typo3 Base Url
+TYPO3_BASE_URL=https://preprod.opentalent.fr/###subDomain###

+ 14 - 0
.env.prod

@@ -0,0 +1,14 @@
+## API Base Url
+SSR_API_BASE_URL = https://ap2i.opentalent.fr
+CLIENT_API_BASE_URL = https://ap2i.opentalent.fr
+
+# Legacy API Base Url
+SSR_APILEG_BASE_URL=https://api.opentalent.fr
+CLIENT_APILEG_BASE_URL=https://api.opentalent.fr
+
+# Legacy Admin Base Url
+SSR_ADMINLEG_BASE_URL=https://admin.opentalent.fr/#
+CLIENT_ADMINLEG_BASE_URL=https://admin.opentalent.fr/#
+
+# Typo3 Base Url
+TYPO3_BASE_URL=https://###subDomain###.opentalent.fr

+ 11 - 8
config/nuxtConfig/env.js

@@ -10,24 +10,27 @@ export default {
   },
   publicRuntimeConfig: {
     http: {
-      browserBaseURL: process.env.NODE_ENV !== 'production' ? 'https://local.new.api.opentalent.fr' : 'https://local.new.api.opentalent.fr'
+      browserBaseURL: process.env.CLIENT_API_BASE_URL
     },
     axios: {
       https: true,
-      browserBaseURL: process.env.NODE_ENV !== 'production' ? 'https://local.new.api.opentalent.fr' : 'https://local.new.api.opentalent.fr'
+      browserBaseURL: process.env.CLIENT_API_BASE_URL,
+      baseURL: process.env.CLIENT_API_BASE_URL
     },
-    baseURL_Legacy: process.env.NODE_ENV !== 'production' ? 'https://local.api.opentalent.fr' : 'https://local.api.opentalent.fr',
-    baseURL_adminLegacy: process.env.NODE_ENV !== 'production' ? 'https://local.admin.opentalent.fr/#' : 'https://admin.opentalent.fr/#',
-    baseURL_typo3: process.env.NODE_ENV !== 'production' ? `https://local.sub.opentalent.fr/###subDomain###` : `https://###subDomain###.opentalent.fr/#`,
+    baseURL_Legacy: process.env.CLIENT_APILEG_BASE_URL,
+    baseURL_adminLegacy: process.env.CLIENT_ADMINLEG_BASE_URL,
+    baseURL_typo3: process.env.CLIENT_TYPO3_BASE_URL
   },
   privateRuntimeConfig: {
     http: {
       https: true,
-      baseURL: process.env.NODE_ENV !== 'production' ? 'http://nginx_new' : 'https://local.api.opentalent.fr'
+      baseURL: process.env.SSR_API_BASE_URL
     },
     axios: {
-      baseURL: process.env.NODE_ENV !== 'production' ? 'http://nginx_new' : 'https://local.api.opentalent.fr'
+      baseURL: process.env.SSR_API_BASE_URL
     },
-    baseURL_Legacy: process.env.NODE_ENV !== 'production' ? 'http://nginx' : 'https://local.api.opentalent.fr'
+    baseURL_Legacy: process.env.SSR_APILEG_BASE_URL,
+    baseURL_adminLegacy: process.env.SSR_ADMINLEG_BASE_URL,
+    baseURL_typo3: process.env.SSR_TYPO3_BASE_URL
   }
 }

+ 2 - 0
package.json

@@ -5,6 +5,8 @@
   "scripts": {
     "dev": "nuxt --hostname '0.0.0.0' --port 3002",
     "build": "nuxt build",
+    "build:preprod": "nuxt build --dotenv .env.preprod",
+    "build:prod": "nuxt build --dotenv .env.prod",
     "start": "nuxt start --hostname '0.0.0.0' --port 3002",
     "generate": "nuxt generate",
     "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",