feat: move url configuration to support file
This commit is contained in:
@@ -22,11 +22,6 @@ WORKDIR /app
|
|||||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
ENV SITE_URL=https://www.alexlebens.dev
|
|
||||||
ENV DIRECTUS_URL=https://directus.alexlebens.net
|
|
||||||
ENV PORT=4321
|
|
||||||
|
|
||||||
LABEL version="2.13.1"
|
LABEL version="2.13.1"
|
||||||
LABEL description="Astro based personal website"
|
LABEL description="Astro based personal website"
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,7 @@ import tailwindcss from '@tailwindcss/vite';
|
|||||||
import icon from 'astro-icon';
|
import icon from 'astro-icon';
|
||||||
import swup from '@swup/astro';
|
import swup from '@swup/astro';
|
||||||
|
|
||||||
const getSiteURL = () => {
|
import { getSiteURL } from './src/support/url';
|
||||||
if (process.env.SITE_URL) {
|
|
||||||
return `https://${process.env.SITE_URL}`;
|
|
||||||
}
|
|
||||||
return 'http://localhost:4321';
|
|
||||||
};
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: getSiteURL(),
|
site: getSiteURL(),
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { Icon } from 'astro-icon/components';
|
|||||||
import type { Post } from '@lib/directusTypes';
|
import type { Post } from '@lib/directusTypes';
|
||||||
|
|
||||||
import Image from '@components/ui/images/Image.astro';
|
import Image from '@components/ui/images/Image.astro';
|
||||||
import { getDirectusImageURL } from '@lib/directusFunctions';
|
|
||||||
import { formatDate } from '@support/time';
|
import { formatDate } from '@support/time';
|
||||||
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
post: Post;
|
post: Post;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
import Logo from '@components/ui/logos/Logo.astro';
|
import Logo from '@components/ui/logos/Logo.astro';
|
||||||
import { getDirectusImageURL } from '@lib/directusFunctions';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
topic: string;
|
topic: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
import Image from '@components/ui/images/Image.astro';
|
import Image from '@components/ui/images/Image.astro';
|
||||||
import { getDirectusImageURL } from '@lib/directusFunctions';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Icon } from 'astro-icon/components';
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
import Image from '@components/ui/images/Image.astro';
|
import Image from '@components/ui/images/Image.astro';
|
||||||
import { getDirectusImageURL } from '@lib/directusFunctions';
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
Skill,
|
Skill,
|
||||||
} from '@lib/directusTypes';
|
} from '@lib/directusTypes';
|
||||||
|
|
||||||
import { getDirectusURL } from '@lib/directusFunctions';
|
import { getDirectusURL } from '@/support/url';
|
||||||
|
|
||||||
type Schema = {
|
type Schema = {
|
||||||
site_global: Global;
|
site_global: Global;
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import Image from '@components/ui/images/Image.astro';
|
|||||||
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
import SocialShareButton from '@components/buttons/SocialShareButton.astro';
|
||||||
import BaseLayout from '@layouts/BaseLayout.astro';
|
import BaseLayout from '@layouts/BaseLayout.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
import { getDirectusImageURL } from '@lib/directusFunctions';
|
|
||||||
import { formatDate } from '@support/time';
|
import { formatDate } from '@support/time';
|
||||||
|
import { getDirectusImageURL } from '@/support/url';
|
||||||
|
|
||||||
const post = Astro.props;
|
const post = Astro.props;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
const getDirectusURL = () => {
|
const getDirectusURL = () => {
|
||||||
if (process.env.DIRECTUS_URL) {
|
|
||||||
return `https://${process.env.DIRECTUS_URL}`;
|
|
||||||
}
|
|
||||||
return 'https://directus.alexlebens.net';
|
return 'https://directus.alexlebens.net';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSiteURL = () => {
|
||||||
|
return 'https://www.alexlebens.dev';
|
||||||
|
};
|
||||||
|
|
||||||
async function getDirectusImageURL(image: string) {
|
async function getDirectusImageURL(image: string) {
|
||||||
return `${getDirectusURL()}/assets/${image}`;
|
return `${getDirectusURL()}/assets/${image}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { getDirectusURL, getDirectusImageURL };
|
export { getDirectusURL, getSiteURL, getDirectusImageURL };
|
||||||
Reference in New Issue
Block a user