diff --git a/README.md b/README.md index 0d6a5b44cf..c9ede2955e 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ docker run -d -p 8080:8080 \ ## Docker Compose ``` +git clone https://github.com/nocodb/nocodb cd docker-compose cd mysql or pg or mssql docker-compose up @@ -170,6 +171,7 @@ docker-compose up | NC_SENTRY_DSN | No | For Sentry monitoring | | | NC_CONNECT_TO_EXTERNAL_DB_DISABLED | No | Disable Project creation with external database | | | NC_DISABLE_TELE | No | Disable telemetry | | +| NC_BACKEND_URL | No | Custom Backend URL | ``http://localhost:8080`` will be used | # Running locally ``` diff --git a/packages/nc-gui/components/changeEnv.vue b/packages/nc-gui/components/changeEnv.vue index 94bd2c0653..344faa9280 100644 --- a/packages/nc-gui/components/changeEnv.vue +++ b/packages/nc-gui/components/changeEnv.vue @@ -72,8 +72,7 @@ await new Promise(resolve => { const interv = setInterval(() => { axios.create({ - baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard', - // baseURL: 'http://localhost:8080/dashboard', + baseURL: `${this.$axios.defaults.baseURL}/dashboard`, }).get('').then(() => { this.projectReloading = false; clearInterval(interv); @@ -105,6 +104,7 @@ * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * diff --git a/packages/nc-gui/components/createOrEditProject.vue b/packages/nc-gui/components/createOrEditProject.vue index ef26be9ae3..f5395c4841 100644 --- a/packages/nc-gui/components/createOrEditProject.vue +++ b/packages/nc-gui/components/createOrEditProject.vue @@ -1388,7 +1388,7 @@ export default { this.allSchemas = true; await this.$axios({ url: 'demo', - baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard', + baseURL: `${this.$axios.defaults.baseURL}/dashboard`, }); }, diff --git a/packages/nc-gui/components/project/graphqlClient.vue b/packages/nc-gui/components/project/graphqlClient.vue index eb18f09109..4838845398 100644 --- a/packages/nc-gui/components/project/graphqlClient.vue +++ b/packages/nc-gui/components/project/graphqlClient.vue @@ -55,7 +55,7 @@ export default { if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url; try { - const {info} = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, { + const {info} = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, { headers: { 'xc-auth': this.$store.state.users.token } diff --git a/packages/nc-gui/components/project/settings/env.vue b/packages/nc-gui/components/project/settings/env.vue index 46b23012e7..bc581bc3be 100644 --- a/packages/nc-gui/components/project/settings/env.vue +++ b/packages/nc-gui/components/project/settings/env.vue @@ -62,8 +62,7 @@ export default { await new Promise(resolve => { const interv = setInterval(() => { axios.create({ - baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard', - // baseURL: 'http://localhost:8080/dashboard', + baseURL: `${this.$axios.defaults.baseURL}/dashboard` }).get('').then(() => { this.projectReloading = false; clearInterval(interv); @@ -94,6 +93,7 @@ export default { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * diff --git a/packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js b/packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js index 926c99c1b3..2b3ae838c8 100644 --- a/packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js +++ b/packages/nc-gui/components/project/spreadsheet/apis/gqlApi.js @@ -29,7 +29,7 @@ export default class GqlApi { post(url, params) { return this.$axios({ - url, + url: `${this.$axios.defaults.baseURL}/${url}`, method: 'post', data: params, }) diff --git a/packages/nc-gui/components/project/swaggerClient.vue b/packages/nc-gui/components/project/swaggerClient.vue index d59d3bddc0..883908a800 100644 --- a/packages/nc-gui/components/project/swaggerClient.vue +++ b/packages/nc-gui/components/project/swaggerClient.vue @@ -55,7 +55,7 @@ export default { // if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) // this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url; try { - const {info} = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, { + const {info} = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, { headers: { 'xc-auth': this.$store.state.users.token } diff --git a/packages/nc-gui/components/project/xcInfo.vue b/packages/nc-gui/components/project/xcInfo.vue index d3535c435f..13f21bfd1c 100644 --- a/packages/nc-gui/components/project/xcInfo.vue +++ b/packages/nc-gui/components/project/xcInfo.vue @@ -241,7 +241,7 @@ export default { async created() { await this.loadProjectApiInfo(); try { - this.iframeUrl = this._isDev ? 'http://localhost:8080/dashboard/status' : './status'; + this.iframeUrl = `${this.$axios.defaults.baseURL}/dashboard/status`; const res = await this.$axios.get(this.iframeUrl); this.showinfoIFrame = true; } catch (e) { @@ -252,7 +252,7 @@ export default { }, methods: { async loadProjectApiInfo() { try { - const {info, aggregatedInfo} = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, { + const {info, aggregatedInfo} = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, { headers: { 'xc-auth': this.$store.state.users.token } @@ -322,6 +322,7 @@ iframe { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * diff --git a/packages/nc-gui/layouts/default.vue b/packages/nc-gui/layouts/default.vue index 1b76d27f5a..5907f95af1 100644 --- a/packages/nc-gui/layouts/default.vue +++ b/packages/nc-gui/layouts/default.vue @@ -624,7 +624,7 @@ --> - + @@ -977,7 +977,7 @@ export default { async loadProjectInfo() { if (this.$route.params.project_id) try { - const {info} = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, { + const {info} = (await this.$axios.get(`${this.$axios.defaults.baseURL}/nc/${this.$route.params.project_id}/projectApiInfo`, { headers: { 'xc-auth': this.$store.state.users.token } diff --git a/packages/nc-gui/nuxt.config.js b/packages/nc-gui/nuxt.config.js index 7520b8c405..ddfdf19ba1 100644 --- a/packages/nc-gui/nuxt.config.js +++ b/packages/nc-gui/nuxt.config.js @@ -86,9 +86,7 @@ export default { ** See https://axios.nuxtjs.org/options */ axios: { - baseURL: process.env.NODE_ENV === 'production' ? '../' : 'http://localhost:8080/', - // baseURL: 'http://localhost:8080/', - // baseURL: 'http://localhost:8080/', + baseURL: process.env.NC_BACKEND_URL || (process.env.NODE_ENV === 'production' ? '../' : 'http://localhost:8080/'), }, /* ** vuetify module configuration @@ -218,6 +216,7 @@ export default { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * @@ -234,26 +233,4 @@ export default { * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . * - */ -/** - * @copyright Copyright (c) 2021, Xgene Cloud Ltd - * - * @author Naveen MR - * @author Pranav C Balan - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ + */ \ No newline at end of file diff --git a/packages/nc-gui/pages/nc/_project_id.vue b/packages/nc-gui/pages/nc/_project_id.vue index 4d2d7adc95..a333ff97d1 100644 --- a/packages/nc-gui/pages/nc/_project_id.vue +++ b/packages/nc-gui/pages/nc/_project_id.vue @@ -47,7 +47,7 @@ export default { this.$router.replace({query: {}}) } try { - hj('stateChange', 'http://localhost:8080/dashboard/#/nc/'); + hj('stateChange', `${this.$axios.defaults.baseURL}/dashboard/#/nc/`); } catch (e) { } }, @@ -112,6 +112,7 @@ export default { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * diff --git a/packages/nc-gui/pages/project/id.vue b/packages/nc-gui/pages/project/id.vue index b4c2cd55d8..c584e06a33 100644 --- a/packages/nc-gui/pages/project/id.vue +++ b/packages/nc-gui/pages/project/id.vue @@ -1113,8 +1113,7 @@ export default { } axios.create({ - baseURL: process.env.NODE_ENV === 'production' ? './' : 'http://localhost:8080/dashboard', - // baseURL: 'http://localhost:8080/dashboard', + baseURL: `${this.$axios.defaults.baseURL}/dashboard`, }).get('').then(() => { toast.goAway(100); this.projectReloading = false; @@ -1692,6 +1691,7 @@ export default { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version * diff --git a/packages/nc-gui/pages/user/authentication/signin.vue b/packages/nc-gui/pages/user/authentication/signin.vue index 9a8d8e3dd1..4da53273a8 100644 --- a/packages/nc-gui/pages/user/authentication/signin.vue +++ b/packages/nc-gui/pages/user/authentication/signin.vue @@ -105,11 +105,7 @@
@@ -154,7 +154,7 @@