More app directory refactoring
This commit is contained in:
parent
b312a8c862
commit
8bbeaa25cf
55 changed files with 903 additions and 899 deletions
17
apps/leafcutter/app/_lib/auth.ts
Normal file
17
apps/leafcutter/app/_lib/auth.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { NextAuthOptions } from "next-auth";
|
||||
import Google from "next-auth/providers/google";
|
||||
import Apple from "next-auth/providers/apple";
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
providers: [
|
||||
Google({
|
||||
clientId: process.env.GOOGLE_CLIENT_ID ?? "",
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
||||
}),
|
||||
Apple({
|
||||
clientId: process.env.APPLE_CLIENT_ID ?? "",
|
||||
clientSecret: process.env.APPLE_CLIENT_SECRET ?? "",
|
||||
}),
|
||||
],
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
};
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import createCache from "@emotion/cache";
|
||||
|
||||
export default function createEmotionCache() {
|
||||
return createCache({ key: "css" });
|
||||
}
|
||||
|
|
@ -8,10 +8,16 @@ const globalIndex = ".kibana_1";
|
|||
const dataIndexName = "sample_tagged_tickets";
|
||||
const userMetadataIndexName = "user_metadata";
|
||||
|
||||
const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
|
||||
// const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
|
||||
|
||||
const baseURL = `https://localhost:9200`;
|
||||
|
||||
const createClient = () => new Client({
|
||||
node: baseURL,
|
||||
auth: {
|
||||
username: process.env.OPENSEARCH_USERNAME!,
|
||||
password: process.env.OPENSEARCH_PASSWORD!,
|
||||
},
|
||||
ssl: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
|
|
@ -532,6 +538,7 @@ export const getTrends = async (limit: number) => {
|
|||
|
||||
export const getTemplates = async (limit: number) => {
|
||||
const client = createClient();
|
||||
|
||||
const query = {
|
||||
query: {
|
||||
bool: {
|
||||
|
|
@ -546,11 +553,14 @@ export const getTemplates = async (limit: number) => {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const rawResponse = await client.search({
|
||||
index: globalIndex,
|
||||
size: limit,
|
||||
body: query,
|
||||
});
|
||||
|
||||
const response = rawResponse.body;
|
||||
const {
|
||||
hits: { hits },
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
import { GetServerSidePropsContext } from "next";
|
||||
|
||||
export const getEmbedded = (context: GetServerSidePropsContext) =>
|
||||
context.req.headers["x-leafcutter-embedded"] === "true";
|
||||
Loading…
Add table
Add a link
Reference in a new issue