Skip to content

Commit

Permalink
Revert "fix bug where variables arent injected correctly" (#214)
Browse files Browse the repository at this point in the history
Revert "fix bug where variables arent injected correctly (#213)"

This reverts commit ccba344.
  • Loading branch information
ssb-jnk authored Apr 9, 2024
1 parent ccba344 commit 7b2f927
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ COPY package*.json .
COPY server.js .

RUN npm i --save-exact express vite-express
RUN cp -R /usr/local/app/dist/* .
WORKDIR /usr/local/app/dist

ENV PORT 8080
EXPOSE 8080

ENTRYPOINT ["sh", "-c", "./vite-envs.sh && npm run prod"]
ENTRYPOINT sh -c "./vite-envs.sh && npm run prod"
77 changes: 12 additions & 65 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"prepare": "npx vite-envs update-types",
"dev": "nodemon server.js -w server.js",
"prod": "NODE_ENV=production node server.js",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint ./src --ext .jsx,.js,.ts,.tsx --quiet --fix --ignore-path ./.gitignore",
"lint:format": "prettier --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "npx vite-envs update-types"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand Down Expand Up @@ -48,7 +48,6 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"typescript": "^5.4.4",
"vite-envs": "^4.0.6",
"vite": "^5.2.8"
}
}
6 changes: 1 addition & 5 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ const Header = () => {
</h2>
<div className={styles.navigation}>
<div className={styles.links}>
<Link
href={import.meta.env.DAPLA_CTRL_DOCUMENTATION_URL ?? ''}
isExternal={true}
icon={<BookOpen size='20' />}
>
<Link href={import.meta.env.DAPLA_CTRL_DOCUMENTATION_URL} isExternal={true} icon={<BookOpen size='20' />}>
Dokumentasjon
</Link>
<Link href='/teammedlemmer'>Teammedlemmer</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TeamOverview/TeamOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const TeamOverview = () => {
title='Teamoversikt'
content={renderContent()}
button={
<Button onClick={() => window.open(import.meta.env.DAPLA_CTRL_DAPLA_START_URL ?? '', 'noopener')}>
<Button onClick={() => window.open(import.meta.env.DAPLA_CTRL_DAPLA_START_URL, 'noopener')}>
+ Opprett team
</Button>
}
Expand Down
7 changes: 3 additions & 4 deletions src/utils/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ const fetchGroupMembership = async (groupUniformName: string): Promise<Group> =>
}

export const isDaplaAdmin = async (userPrincipalName: string): Promise<boolean> => {
const adminGroups = import.meta.env.DAPLA_CTRL_ADMIN_GROUPS ?? ''
const daplaAdminGroupsSeperated = adminGroups.split(',')
if (daplaAdminGroupsSeperated.length === 0) return false
const daplaAdminGroups = import.meta.env.DAPLA_CTRL_ADMIN_GROUPS.split(',')
if (daplaAdminGroups.length === 0) return false

try {
const adminGroupUsers = await Promise.all(
daplaAdminGroupsSeperated.map((groupUniformName) => fetchGroupMembership(groupUniformName))
daplaAdminGroups.map((groupUniformName) => fetchGroupMembership(groupUniformName))
)

return adminGroupUsers.some(
Expand Down
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default defineConfig({
plugins: [
react(),
viteEnvs({
declarationFile: '.env',
computedEnv: async ({ resolvedConfig }) => {
const path = await import('path')
const fs = await import('fs/promises')
Expand Down

0 comments on commit 7b2f927

Please sign in to comment.