From 59a83c1978871b36ec6f4ddc459ef5e2d5db5f46 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Sat, 16 Mar 2024 17:03:46 +0100 Subject: [PATCH] - change env variable VUE_APP_PORTAL to VUE_API - added .env.example file --- .env.example | 4 ++++ src/app.ts | 4 ++-- src/app2.ts | 4 ++-- src/constants.ts | 6 +++--- src/notes.txt | 2 +- src/services/dataset.service.ts | 18 +++++++++--------- .../dataset-detail.component.ts | 4 ++-- vue.config.js | 4 ++-- 8 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ea6aeaa --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +APP_URL=//tethys.at +VUE_API=//www.tethys.at +SOLR_HOST=tethys.at +SOLR_CORE=rdr_data \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 39b4807..16e5b59 100644 --- a/src/app.ts +++ b/src/app.ts @@ -11,7 +11,7 @@ import ContactViewComponent from "./views/contact-view/contact-view-component.vu import SitelinkViewComponent from "./views/sitelink-view/sitelink-view-component.vue"; import ImprintViewComponent from "./views/imprint-view/imprint-view-component.vue"; import TermsViewComponent from "./views/terms-view/terms-view-component"; -import { VUE_APP_PORTAL } from "./constants"; +import { VUE_API } from "./constants"; // import VsInput from "./components/vs-input/vs-input.vue"; // import VsResult from "./components/vs-result/vs-result.vue"; // import FacetCategory from "./components/face-category/facet-category.vue"; @@ -46,7 +46,7 @@ import { VUE_APP_PORTAL } from "./constants"; }) export default class App extends Vue { public active = false; - public portal = VUE_APP_PORTAL + "/login"; + public portal = VUE_API + "/login"; mounted(): void { // const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll(".navbar-burger"), 0); diff --git a/src/app2.ts b/src/app2.ts index bd964d5..4f7bc99 100644 --- a/src/app2.ts +++ b/src/app2.ts @@ -10,7 +10,7 @@ import ContactViewComponent from "./views/contact-view/contact-view-component.vu import SitelinkViewComponent from "./views/sitelink-view/sitelink-view-component.vue"; import ImprintViewComponent from "./views/imprint-view/imprint-view-component.vue"; import TermsViewComponent from "./views/terms-view/terms-view-component"; -import { APP_URL, VUE_APP_PORTAL } from "./constants"; +import { APP_URL, VUE_API } from "./constants"; // import VsInput from "./components/vs-input/vs-input.vue"; // import VsResult from "./components/vs-result/vs-result.vue"; // import FacetCategory from "./components/face-category/facet-category.vue"; @@ -44,7 +44,7 @@ import { APP_URL, VUE_APP_PORTAL } from "./constants"; }) export default class App2 extends Vue { public active = false; - public portal = VUE_APP_PORTAL + "/login"; + public portal = VUE_API + "/login"; public app_url = APP_URL; public search_url = APP_URL + "/search"; public service_url = APP_URL + "/services"; diff --git a/src/constants.ts b/src/constants.ts index 1f87e03..acd7381 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,20 +1,20 @@ // declare const POINT_URL: string; // declare const EDGE_URL: string; declare const APP_URL: string; -declare const VUE_APP_PORTAL: string; +declare const VUE_API: string; declare const SOLR_HOST: string; declare const SOLR_CORE: string; // const _EDGE_URL = EDGE_URL; // const _POINT_URL = POINT_URL; const _APP_URL = APP_URL; -const _VUE_APP_PORTAL = VUE_APP_PORTAL; +const _VUE_API = VUE_API; const _SOLR_HOST = SOLR_HOST; const _SOLR_CORE = SOLR_CORE; // export { _EDGE_URL as EDGE_URL }; // export { _POINT_URL as POINT_URL }; export { _APP_URL as APP_URL }; -export { _VUE_APP_PORTAL as VUE_APP_PORTAL }; +export { _VUE_API as VUE_API }; export { _SOLR_HOST as SOLR_HOST }; export { _SOLR_CORE as SOLR_CORE }; diff --git a/src/notes.txt b/src/notes.txt index 4c3357a..96d0122 100644 --- a/src/notes.txt +++ b/src/notes.txt @@ -119,7 +119,7 @@ const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); configureWebpack: { plugins: [ new webpack.DefinePlugin({ - VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL), + VUE_API: JSON.stringify(process.env.VUE_API), SOLR_HOST: JSON.stringify(process.env.SOLR_HOST), SOLR_CORE: JSON.stringify(process.env.SOLR_CORE), }), diff --git a/src/services/dataset.service.ts b/src/services/dataset.service.ts index e9ff8fb..4643ea9 100644 --- a/src/services/dataset.service.ts +++ b/src/services/dataset.service.ts @@ -5,7 +5,7 @@ import { map } from "rxjs/operators"; import { Dataset, DbDataset, Suggestion } from "@/models/dataset"; import { SolrResponse } from "@/models/headers"; import { ActiveFilterCategories } from "@/models/solr"; -import { VUE_APP_PORTAL } from "@/constants"; +import { VUE_API } from "@/constants"; // import { deserialize, instanceToInstance } from "class-transformer"; import { deserialize } from "class-transformer"; // import { OAI_DATASETS } from "./mock-oai-datasets"; @@ -171,8 +171,8 @@ class DatasetService { public getYears(): Observable { // const heroes = of(HEROES); - // const host = "https:" + VUE_APP_PORTAL; - const host = VUE_APP_PORTAL; + // const host = "https:" + VUE_API; + const host = VUE_API; const path = "/api/years"; const base = host + path; @@ -182,8 +182,8 @@ class DatasetService { } public getDocuments(year: string): Observable> { - // const host = "https:" + VUE_APP_PORTAL; - const host = VUE_APP_PORTAL; + // const host = "https:" + VUE_API; + const host = VUE_API; const path = "/api/sitelinks/" + year; const base = host + path; @@ -193,8 +193,8 @@ class DatasetService { } public getDataset(id: number): Observable { - // const host = "https:" + VUE_APP_PORTAL; - const host = VUE_APP_PORTAL; + // const host = "https:" + VUE_API; + const host = VUE_API; const path = "/api/dataset/" + id; const apiUrl = host + path; const dataset = api.get(apiUrl).pipe(map((res) => this.prepareDataset(res))); @@ -205,8 +205,8 @@ class DatasetService { } public getDatasetByDoi(doi: string): Observable { - // const host = "https:" + VUE_APP_PORTAL; - const host = VUE_APP_PORTAL; + // const host = "https:" + VUE_API; + const host = VUE_API; const path = "/api/dataset/10.24341/tethys." + doi; const apiUrl = host + path; const dataset = api.get(apiUrl).pipe(map((res) => this.prepareDataset(res))); diff --git a/src/views/dataset-detail.component/dataset-detail.component.ts b/src/views/dataset-detail.component/dataset-detail.component.ts index 9ebdf50..fc7a222 100644 --- a/src/views/dataset-detail.component/dataset-detail.component.ts +++ b/src/views/dataset-detail.component/dataset-detail.component.ts @@ -8,7 +8,7 @@ import advancedFormat from "dayjs/plugin/advancedFormat"; // import SimpleSearchComponent from "@/components/simple-search/simple-search-component.vue"; import VsInput from "@/components/vs-input/vs-input.vue"; import { Suggestion } from "@/models/dataset"; -import { VUE_APP_PORTAL } from "@/constants"; +import { VUE_API } from "@/constants"; // import DataMetricsBadge from "data-metrics-badge/dist/data-metrics-badge.js"; // import DataMetricsBadge from "@/components/datacite/DataMetricsBadge.vue"; @@ -33,7 +33,7 @@ export default class DatasetDetailComponent extends Vue { private error = ""; public loaded = false; public openAccessLicences: Array = ["CC-BY-4.0", "CC-BY-SA-4.0"]; - public portal = VUE_APP_PORTAL + "/api/file/download/"; + public portal = VUE_API + "/api/file/download/"; public post = { views: 25, diff --git a/vue.config.js b/vue.config.js index ddfcf18..539ff81 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,7 +15,7 @@ module.exports = { // .tap(args => { // args[0] = { // ...args[0], - // VUE_APP_PORTAL: JSON.stringify(process.env.PORTAL), + // VUE_API: JSON.stringify(process.env.PORTAL), // // other stuff // } // return args @@ -87,7 +87,7 @@ module.exports = { __VUE_PROD_DEVTOOLS__: "false", __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false", APP_URL: JSON.stringify(process.env.APP_URL), - VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL), + VUE_API: JSON.stringify(process.env.VUE_API), SOLR_HOST: JSON.stringify(process.env.SOLR_HOST), SOLR_CORE: JSON.stringify(process.env.SOLR_CORE), }),