Skip to content

Commit

Permalink
refactor(dashboard,serverless): remove useless LAGON_TOKEN env variab…
Browse files Browse the repository at this point in the history
…le (#558)
  • Loading branch information
QuiiBz authored Feb 3, 2023
1 parent 15477b1 commit fea698a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
1 change: 0 additions & 1 deletion crates/serverless/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
LAGON_TOKEN=
LAGON_ROOT_DOMAIN=lagon.app
LAGON_REGION=
LAGON_ISOLATES_CACHE_SECONDS=60
Expand Down
1 change: 0 additions & 1 deletion packages/dashboard/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ DATABASE_URL=mysql://root:mysql@localhost:3306/lagon
PROMETHEUS_ENDPOINT=http://localhost:9090
PROMETHEUS_USERNAME=
PROMETHEUS_PASSWORD=
LAGON_TOKEN=
LAGON_RESTRICT_LOGIN=false
LAGON_BLACKLISTED_FUNCTIONS_NAMES=
NEXT_PUBLIC_LAGON_ROOT_SCHEM=http
Expand Down
21 changes: 2 additions & 19 deletions packages/dashboard/lib/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
import { withSentry } from '@sentry/nextjs';
import { NextApiHandler } from 'next';

type ApiHandlerOptions = {
tokenAuth?: boolean;
};

export default function apiHandler(
nextHandler: NextApiHandler,
options: ApiHandlerOptions = { tokenAuth: true },
): NextApiHandler {
const { tokenAuth } = options;

return async (request, response) => {
if (tokenAuth) {
if (request.headers['x-lagon-token'] !== process.env.LAGON_TOKEN) {
return response.status(401).end();
}
}

return withSentry(nextHandler)(request, response);
};
export default function apiHandler(nextHandler: NextApiHandler): NextApiHandler {
return async (request, response) => withSentry(nextHandler)(request, response);
}
2 changes: 1 addition & 1 deletion packages/dashboard/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ export const authOptions: NextAuthOptions = {
},
};

export default apiHandler(NextAuth(authOptions), { tokenAuth: false });
export default apiHandler(NextAuth(authOptions));

1 comment on commit fea698a

@vercel
Copy link

@vercel vercel bot commented on fea698a Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dashboard – ./packages/dashboard

dashboard-lagon.vercel.app
dashboard-git-main-lagon.vercel.app
dash.lagon.app

Please sign in to comment.