Skip to content

Commit

Permalink
feat: shared config endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
wainola committed Aug 15, 2024
1 parent d648e9a commit 34e6f32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/DomainController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SPDX-License-Identifier: LGPL-3.0-only
*/
import { FastifyReply, FastifyRequest } from "fastify"
import { Environment } from "@buildwithsygma/sygma-sdk-core"
import { getSharedConfig } from "../indexer/config"
import { logger } from "../utils/logger"
import { DomainMetadataConfig } from "../utils/domainMetadata"

Expand All @@ -19,4 +20,8 @@ export const DomainsController = {
void reply.status(500)
}
},
sharedConfig: async function (request: FastifyRequest<{}>, reply: FastifyReply): Promise<void> {
const sharedConfig = await getSharedConfig(process.env.SHARED_CONFIG_URL!)
void reply.status(200).send(sharedConfig)
},
}
7 changes: 7 additions & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,11 @@ export async function routes(fastify: FastifyInstance): Promise<void> {
schema: routesByDomainSchema,
handler: RoutesController.routes,
})

fastify.route({
method: "GET",
url: "/domains/shared-config",
// schema: routesByDomainSchema,
handler: DomainsController.sharedConfig,
})
}

0 comments on commit 34e6f32

Please sign in to comment.