Skip to content

Commit

Permalink
feat: make public matrix client url an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrusegard committed Jan 26, 2025
1 parent ecff3fb commit 737ddd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ FEIDE_EXTENDED_USERINFO_ENDPOINT="https://api.dataporten.no/userinfo/v1/userinfo

# Matrix
MATRIX_SERVER_NAME=""
MATRIX_ENDPOINT="https://matrix.hackerspace-ntnu.no/_synapse/admin"
MATRIX_ENDPOINT=""
MATRIX_SECRET=""
NEXT_PUBLIC_MATRIX_CLIENT_URL=""
3 changes: 2 additions & 1 deletion src/components/layout/header/MatrixLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MatrixLogo } from '@/components/assets/logos';
import { ExternalLink } from '@/components/ui/Link';
import { env } from '@/env';

type MatrixLinkProps = {
className?: string;
Expand All @@ -14,7 +15,7 @@ function MatrixLink({ className, t }: MatrixLinkProps) {
className={className}
variant='ghost'
size='icon'
href='https://element.hackerspace-ntnu.no/#/login'
href={env.NEXT_PUBLIC_MATRIX_CLIENT_URL ?? '#'}
title={t.title}
aria-label={t.title}
>
Expand Down
2 changes: 2 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const env = createEnv({
*/
client: {
NEXT_PUBLIC_SITE_URL: z.string(),
NEXT_PUBLIC_MATRIX_CLIENT_URL: z.string().optional(),
},

/**
Expand Down Expand Up @@ -64,6 +65,7 @@ export const env = createEnv({
MATRIX_SERVER_NAME: process.env.MATRIX_SERVER_NAME,
MATRIX_SECRET: process.env.MATRIX_SECRET,
MATRIX_ENDPOINT: process.env.MATRIX_ENDPOINT,
NEXT_PUBLIC_MATRIX_CLIENT_URL: process.env.NEXT_PUBLIC_MATRIX_CLIENT_URL,
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL,
},
/**
Expand Down

0 comments on commit 737ddd7

Please sign in to comment.