Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/runtimeconfig #14

Merged
merged 7 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/imprint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const env = useRuntimeConfig();

const locale = useLocale();

const redmineId = env.public.NUXT_PUBLIC_REDMINE_ID;
const redmineId = env.public.redmineId;

const imprint = await useFetch(String(createImprintUrl(locale.value, redmineId)), {
responseType: "text",
Expand Down
11 changes: 4 additions & 7 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ useHead({
property: "og:image",
content: String(
createUrl({
baseUrl: env.public.NUXT_PUBLIC_APP_BASE_URL,
baseUrl: env.public.appBaseUrl,
pathname: "/opengraph-image.png",
}),
),
Expand All @@ -68,17 +68,14 @@ useHead({
{ type: "application/ld+json", innerHTML: JSON.stringify(jsonLd, safeJsonLdReplacer) },
];

if (
isNonEmptyString(env.public.NUXT_PUBLIC_MATOMO_BASE_URL) &&
isNonEmptyString(env.public.NUXT_PUBLIC_MATOMO_ID)
) {
const baseUrl = env.public.NUXT_PUBLIC_MATOMO_BASE_URL;
if (isNonEmptyString(env.public.matomoBaseUrl) && isNonEmptyString(env.public.matomoId)) {
const baseUrl = env.public.matomoBaseUrl;

scripts.push({
type: "",
innerHTML: createAnalyticsScript(
baseUrl.endsWith("/") ? baseUrl : baseUrl + "/",
env.public.NUXT_PUBLIC_MATOMO_ID,
env.public.matomoId,
),
});
}
Expand Down
10 changes: 5 additions & 5 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ export default defineNuxtConfig({
runtimeConfig: {
NODE_ENV: process.env.NODE_ENV,
public: {
NUXT_PUBLIC_APP_BASE_URL: process.env.NUXT_PUBLIC_APP_BASE_URL,
NUXT_PUBLIC_BOTS: process.env.NUXT_PUBLIC_BOTS,
NUXT_PUBLIC_MATOMO_BASE_URL: process.env.NUXT_PUBLIC_MATOMO_BASE_URL,
NUXT_PUBLIC_MATOMO_ID: process.env.NUXT_PUBLIC_MATOMO_ID,
NUXT_PUBLIC_REDMINE_ID: process.env.NUXT_PUBLIC_REDMINE_ID,
appBaseUrl: process.env.NUXT_PUBLIC_APP_BASE_URL,
bots: process.env.NUXT_PUBLIC_BOTS,
matomoBaseUrl: process.env.NUXT_PUBLIC_MATOMO_BASE_URL,
matomoId: process.env.NUXT_PUBLIC_MATOMO_ID,
redmineId: process.env.NUXT_PUBLIC_REDMINE_ID,
},
},
typescript: {
Expand Down
8 changes: 5 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ pnpm run dev
and set the `SERVICE_ID` github variable to the issue number. this should match the
`NUXT_PUBLIC_REDMINE_ID` variable in your `.env.local` file.
- ensure required build args (prefixed with `NUXT_PUBLIC_`) are referenced in both the
[`Dockerfle`](./Dockerfile), as well as the [validation](./.github/workflows/validate.yml) as
[`Dockerfile`](./Dockerfile), as well as the [validation](./.github/workflows/validate.yml) as
ctot-nondef marked this conversation as resolved.
Show resolved Hide resolved
[deployment](./.github/workflows/build-deploy.yml) pipelines, and set as github variables.
- ensure required runtime environment variables are referenced in the
[validation](./.github/workflows/validate.yml) and
[deployment](./.github/workflows/build-deploy.yml) pipelines, and set as github secrets. github
secrets need to be prefixed with `K8S_SECRET_` to be automatically copied to the runtime
environment. in case you need secrets in the docker build context, you can
[mount a secret in the Dockerfile](https://docs.docker.com/build/building/secrets/).
- ensure both the github repository, as well as the
[mount a secret in the Dockerfile](https://docs.docker.com/build/building/secrets/). To enable
override of build values through runtime env vars note the
ctot-nondef marked this conversation as resolved.
Show resolved Hide resolved
[naming conventions](https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables)
- ensure both the github repository, and the
[package registry](https://github.com/orgs/acdh-oeaw/packages/container/my-app/settings) is set to
public.

Expand Down
Loading