Skip to content

Commit 2934a09

Browse files
ludovicm67hupf
authored andcommitted
endpoints: prepare for prod cutover
1 parent abeb8b5 commit 2934a09

34 files changed

Lines changed: 298 additions & 94 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ You can also check the
1111

1212
## Unreleased
1313

14+
- Maintenance
15+
- Update available data sources after LINDAS PROD cut over
1416
- Fixes
1517
- Fix XSS vulnerability caused by unescaped map layer attributions
1618
- Allow GraphQL endpoint to return larger responses by increasing the response

app/.env.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
DATABASE_URL=postgres://postgres:password@localhost:5432/visualization_tool
2-
ENDPOINT=sparql+https://lindas-cached.cluster.ldbar.ch/query
2+
ENDPOINT=sparql+https://cached.lindas.admin.ch/query
33
SPARQL_GEO_ENDPOINT=https://geo.ld.admin.ch/query
44
GRAPHQL_ENDPOINT=/api/graphql
5-
WHITELISTED_DATA_SOURCES=["Prod", "Prod-uncached", "Int", "Int-uncached", "Test", "Test-uncached", "LINDASnext-Prod", "LINDASnext-Prod-uncached", "LINDASnext-Int", "LINDASnext-Int-uncached", "LINDASold-Test", "LINDASold-Test-uncached"]
5+
WHITELISTED_DATA_SOURCES=["Prod", "Prod-uncached", "Int", "Int-uncached", "Test", "Test-uncached", "LINDASold-Prod", "LINDASold-Prod-uncached", "LINDASold-Int", "LINDASold-Int-uncached", "LINDASold-Test", "LINDASold-Test-uncached"]
66
NEXT_PUBLIC_VECTOR_TILE_URL=https://world.vectortiles.geo.admin.ch
77
NEXT_PUBLIC_MAPTILER_STYLE_KEY=123
88
ADFS_PROFILE_URL=https://www.myaccount-r.eiam.admin.ch/

app/components/graphql-termsets.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Termsets = () => {
1919
variables: {
2020
locale: "en",
2121
sourceType: "sparql",
22-
sourceUrl: "https://lindas-cached.cluster.ldbar.ch/query",
22+
sourceUrl: "https://cached.lindas.admin.ch/query",
2323
cubeFilter: {
2424
iri: cube,
2525
},

app/docs/catalog/chart-preview-via-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ An example configurator state is shown below.
165165
"https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/7",
166166
dataSource: {
167167
type: "sparql",
168-
url: "https://lindas-cached.cluster.ldbar.ch/query",
168+
url: "https://cached.lindas.admin.ch/query",
169169
},
170170
meta: {
171171
title: {

app/domain/data-source/constants.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import keyBy from "lodash/keyBy";
22

33
import { WHITELISTED_DATA_SOURCES } from "../env";
44

5-
export const LEGACY_PROD_DATA_SOURCE_URL = "https://lindas.admin.ch/query";
5+
export const UNCACHED_PROD_DATA_SOURCE_URL = "https://lindas.admin.ch/query";
66

7-
export const PROD_DATA_SOURCE_URL =
8-
"https://lindas-cached.cluster.ldbar.ch/query";
7+
export const PROD_DATA_SOURCE_URL = "https://cached.lindas.admin.ch/query";
98

109
interface SourceOption {
1110
value: string;
@@ -26,32 +25,13 @@ export const SOURCE_OPTIONS: SourceOption[] = [
2625
supportsCachingPerCubeIri: true,
2726
},
2827
{
29-
value: "sparql+https://lindas.admin.ch/query",
28+
value: `sparql+${UNCACHED_PROD_DATA_SOURCE_URL}`,
3029
key: "Prod-uncached",
3130
label: "LINDAS PROD (uncached)",
32-
url: "https://lindas.admin.ch/query",
31+
url: UNCACHED_PROD_DATA_SOURCE_URL,
3332
isTrusted: true,
3433
supportsCachingPerCubeIri: true,
3534
},
36-
37-
// For LINDASnext
38-
{
39-
value: "sparql+https://cached.lindas.admin.ch/query",
40-
key: "LINDASnext-Prod",
41-
label: "LINDASnext PROD",
42-
url: "https://cached.lindas.admin.ch/query",
43-
isTrusted: true,
44-
supportsCachingPerCubeIri: true,
45-
},
46-
{
47-
value: "sparql+https://lindas.cz-aws.net/query",
48-
key: "LINDASnext-Prod-uncached",
49-
label: "LINDASnext PROD (uncached)",
50-
url: "https://lindas.cz-aws.net/query",
51-
isTrusted: false,
52-
supportsCachingPerCubeIri: true,
53-
},
54-
// Migration done for the following data sources
5535
{
5636
value: "sparql+https://int.cached.lindas.admin.ch/query",
5737
key: "Int",
@@ -86,6 +66,22 @@ export const SOURCE_OPTIONS: SourceOption[] = [
8666
},
8767

8868
// For LINDASold
69+
{
70+
value: "sparql+https://lindas-cached.cluster.ldbar.ch/query",
71+
key: "LINDASold-Prod",
72+
label: "LINDASold PROD",
73+
url: "https://lindas-cached.cluster.ldbar.ch/query",
74+
isTrusted: false,
75+
supportsCachingPerCubeIri: true,
76+
},
77+
{
78+
value: "sparql+https://old.ld.ldbar.ch/query",
79+
key: "LINDASold-Prod-uncached",
80+
label: "LINDASold PROD (uncached)",
81+
url: "https://old.ld.ldbar.ch/query",
82+
isTrusted: false,
83+
supportsCachingPerCubeIri: true,
84+
},
8985
{
9086
value: "sparql+https://lindas-cached.int.cluster.ldbar.ch/query",
9187
key: "LINDASold-Int",

app/domain/data-source/index.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const createRouter = ({ query }: { query: Record<string, string> }) => {
3333

3434
vi.mock("../env", () => ({
3535
WHITELISTED_DATA_SOURCES: ["Test", "Prod", "Int"],
36-
ENDPOINT: "sparql+https://lindas-cached.cluster.ldbar.ch/query", // Default is Prod in tests
36+
ENDPOINT: "sparql+https://cached.lindas.admin.ch/query", // Default is Prod in tests
3737
}));
3838

3939
describe("datasource state hook", () => {
@@ -88,7 +88,7 @@ describe("datasource state hook", () => {
8888

8989
expect(getState()).toEqual({
9090
type: "sparql",
91-
url: "https://lindas-cached.cluster.ldbar.ch/query",
91+
url: "https://cached.lindas.admin.ch/query",
9292
});
9393
});
9494

@@ -125,7 +125,7 @@ describe("datasource state hook", () => {
125125
act(() => {
126126
setState({
127127
type: "sparql",
128-
url: "https://lindas-cached.cluster.ldbar.ch/query",
128+
url: "https://cached.lindas.admin.ch/query",
129129
});
130130
});
131131

app/domain/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const PUBLIC_URL = (
2424
export const ENDPOINT =
2525
clientEnv?.ENDPOINT ??
2626
process.env.ENDPOINT ??
27-
"sparql+https://lindas-cached.cluster.ldbar.ch/query";
27+
"sparql+https://cached.lindas.admin.ch/query";
2828

2929
export const WHITELISTED_DATA_SOURCES = clientEnv?.WHITELISTED_DATA_SOURCES ??
3030
(process.env.WHITELISTED_DATA_SOURCES !== undefined

app/pages/_preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const CONFIGURATOR_STATE_COLUMN = {
5555
"https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/2",
5656
dataSource: {
5757
type: "sparql",
58-
url: "https://lindas-cached.cluster.ldbar.ch/query",
58+
url: "https://cached.lindas.admin.ch/query",
5959
},
6060
meta: {
6161
title: { de: "", fr: "", it: "", en: "" },

app/pages/_preview_post.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const photovoltaikanlagenState = {
3939
"https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/7",
4040
dataSource: {
4141
type: "sparql",
42-
url: "https://lindas-cached.cluster.ldbar.ch/query",
42+
url: "https://cached.lindas.admin.ch/query",
4343
},
4444
meta: {
4545
title: {
@@ -111,7 +111,7 @@ const nfiState = {
111111
dataSet: "https://environment.ld.admin.ch/foen/nfi/nfi_C-1266/cube/2023-1",
112112
dataSource: {
113113
type: "sparql",
114-
url: "https://lindas-cached.cluster.ldbar.ch/query",
114+
url: "https://cached.lindas.admin.ch/query",
115115
},
116116
meta: {
117117
title: {

app/test/__fixtures/config/prod/column-1.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22
"key": "g_Dcz7A82MNj",
33
"data": {
44
"meta": {
5-
"title": { "de": "", "en": "", "fr": "", "it": "" },
6-
"description": { "de": "", "en": "", "fr": "", "it": "" }
5+
"title": {
6+
"de": "",
7+
"en": "",
8+
"fr": "",
9+
"it": ""
10+
},
11+
"description": {
12+
"de": "",
13+
"en": "",
14+
"fr": "",
15+
"it": ""
16+
}
717
},
818
"dataSet": "http://environment.ld.admin.ch/foen/px/0703010000_105/dataset",
919
"dataSource": {
1020
"type": "sparql",
11-
"url": "https://lindas-cached.cluster.ldbar.ch/query"
21+
"url": "https://cached.lindas.admin.ch/query"
1222
},
1323
"chartConfig": {
1424
"version": "1.2.1",

0 commit comments

Comments
 (0)