-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(datagouv-components): 🏷️ add missing env file * feat(datagouv-components): 🏷️ Type config * fix(datagouv-components): 🚑 fix api url not updating on config updates * fix: ⬆️ update data.gouv.fr-components to fix api url issues
- Loading branch information
1 parent
51a77fc
commit 6807130
Showing
6 changed files
with
88 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 42 additions & 42 deletions
84
udata_front/theme/gouvfr/datagouv-components/src/config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
import { reactive, readonly, ref } from "vue"; | ||
|
||
const admin_root = ref(import.meta.env.VITE_ADMIN_ROOT); | ||
const admin_root = ref<string>(import.meta.env.VITE_ADMIN_ROOT); | ||
|
||
const api_root = ref(import.meta.env.VITE_API_URL); | ||
const api_root = ref<string>(import.meta.env.VITE_API_URL); | ||
|
||
const api_2_root = ref(import.meta.env.VITE_API_2_URL); | ||
const api_2_root = ref<string>(import.meta.env.VITE_API_2_URL); | ||
|
||
const show_copy_resource_permalink = ref(import.meta.env.VITE_SHOW_COPY_RESOURCE_PERMALINK === "true"); | ||
const show_copy_resource_permalink = ref<boolean>(import.meta.env.VITE_SHOW_COPY_RESOURCE_PERMALINK === "true"); | ||
|
||
const schema_documentation_url = ref(import.meta.env.VITE_SCHEMA_DOCUMENTATION_URL); | ||
const schema_documentation_url = ref<string>(import.meta.env.VITE_SCHEMA_DOCUMENTATION_URL); | ||
|
||
const schema_catalog_url = ref(import.meta.env.VITE_SCHEMA_CATALOG_URL); | ||
const schema_catalog_url = ref<string>(import.meta.env.VITE_SCHEMA_CATALOG_URL); | ||
|
||
const schema_validata_url = ref(import.meta.env.VITE_SCHEMA_VALIDATA_URL); | ||
const schema_validata_url = ref<string>(import.meta.env.VITE_SCHEMA_VALIDATA_URL); | ||
|
||
const site_root = ref(import.meta.env.VITE_SITE_ROOT_URL); | ||
const site_root = ref<string>(import.meta.env.VITE_SITE_ROOT_URL); | ||
|
||
const static_root = ref(import.meta.env.VITE_STATIC_ROOT_URL); | ||
const static_root = ref<string>(import.meta.env.VITE_STATIC_ROOT_URL); | ||
|
||
const title = ref(import.meta.env.VITE_TITLE); | ||
const title = ref<string>(import.meta.env.VITE_TITLE); | ||
|
||
const explorable_resources = ref<Array<string>>([]); | ||
|
||
const only_locales = ref(import.meta.env.VITE_ONLY_LOCALES); | ||
const only_locales = ref<string>(import.meta.env.VITE_ONLY_LOCALES); | ||
|
||
const default_lang = ref(import.meta.env.VITE_DEFAULT_LANG); | ||
const default_lang = ref<string>(import.meta.env.VITE_DEFAULT_LANG); | ||
|
||
const guides_quality_url = ref(import.meta.env.VITE_GUIDES_QUALITY_URL); | ||
const guides_quality_url = ref<string>(import.meta.env.VITE_GUIDES_QUALITY_URL); | ||
|
||
const localConfig = reactive({ | ||
admin_root, | ||
api_root, | ||
api_2_root, | ||
default_lang, | ||
explorable_resources, | ||
guides_quality_url, | ||
only_locales, | ||
schema_catalog_url, | ||
schema_documentation_url, | ||
schema_validata_url, | ||
site_root, | ||
static_root, | ||
show_copy_resource_permalink, | ||
title, | ||
admin_root, | ||
api_root, | ||
api_2_root, | ||
default_lang, | ||
explorable_resources, | ||
guides_quality_url, | ||
only_locales, | ||
schema_catalog_url, | ||
schema_documentation_url, | ||
schema_validata_url, | ||
site_root, | ||
static_root, | ||
show_copy_resource_permalink, | ||
title, | ||
}); | ||
|
||
const config = readonly(localConfig); | ||
|
||
const setupComponents = (config: Partial<typeof localConfig>) => { | ||
const mergedConfig = {...localConfig, ...config}; | ||
admin_root.value = mergedConfig.admin_root; | ||
default_lang.value = mergedConfig.default_lang; | ||
explorable_resources.value = mergedConfig.explorable_resources; | ||
guides_quality_url.value = mergedConfig.guides_quality_url; | ||
only_locales.value = mergedConfig.only_locales; | ||
schema_catalog_url.value = mergedConfig.schema_catalog_url; | ||
schema_documentation_url.value = mergedConfig.schema_documentation_url; | ||
schema_validata_url.value = mergedConfig.schema_validata_url; | ||
show_copy_resource_permalink.value = mergedConfig.show_copy_resource_permalink; | ||
site_root.value = mergedConfig.site_root; | ||
static_root.value = mergedConfig.static_root; | ||
title.value = mergedConfig.title; | ||
api_root.value = mergedConfig.api_root; | ||
api_2_root.value = mergedConfig.api_2_root; | ||
const mergedConfig = {...localConfig, ...config}; | ||
admin_root.value = mergedConfig.admin_root; | ||
default_lang.value = mergedConfig.default_lang; | ||
explorable_resources.value = mergedConfig.explorable_resources; | ||
guides_quality_url.value = mergedConfig.guides_quality_url; | ||
only_locales.value = mergedConfig.only_locales; | ||
schema_catalog_url.value = mergedConfig.schema_catalog_url; | ||
schema_documentation_url.value = mergedConfig.schema_documentation_url; | ||
schema_validata_url.value = mergedConfig.schema_validata_url; | ||
show_copy_resource_permalink.value = mergedConfig.show_copy_resource_permalink; | ||
site_root.value = mergedConfig.site_root; | ||
static_root.value = mergedConfig.static_root; | ||
title.value = mergedConfig.title; | ||
api_root.value = mergedConfig.api_root; | ||
api_2_root.value = mergedConfig.api_2_root; | ||
}; | ||
|
||
export { config, setupComponents }; |
21 changes: 21 additions & 0 deletions
21
udata_front/theme/gouvfr/datagouv-components/src/vite-env.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference types="vite/client" /> | ||
|
||
interface ImportMetaEnv { | ||
readonly VITE_ADMIN_ROOT: string; | ||
readonly VITE_SHOW_COPY_RESOURCE_PERMALINK: string; | ||
readonly VITE_SCHEMA_DOCUMENTATION_URL: string; | ||
readonly VITE_SCHEMA_CATALOG_URL: string; | ||
readonly VITE_SCHEMA_VALIDATA_URL: string; | ||
readonly VITE_TITLE: string; | ||
readonly VITE_ONLY_LOCALES: string; | ||
readonly VITE_DEFAULT_LANG: string; | ||
readonly VITE_API_URL: string; | ||
readonly VITE_API_2_URL: string; | ||
readonly VITE_SITE_ROOT_URL: string; | ||
readonly VITE_STATIC_ROOT_URL: string; | ||
readonly VITE_GUIDES_QUALITY_URL: string; | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv; | ||
} |