hey everyone, has anyone created GraphQL resolvers in Faststore v2 following this documentation? https://www.faststore.dev/docs/api-extensions/extending-api-schema#extending-faststore-api-with-third-party-api-schemas
I managed to create a resolver to retrieve seller information through the /api/seller-register/pvt/sellers endpoint, where I use the X-VTEX-API-AppKey and X-VTEX-API-AppToken headers with their respective application key values.
my question is: where should I store these key values??
I understand that hardcoding them directly in the code isn’t an issue from the client’s perspective since the resolver runs server-side and the repository created in Faststore Onboarding is private — but it’s still not a good practice. I thought about using a local .env file and GitHub variables, but I couldn’t find a way to read those variables.
resolver code, with the account, key, and token values omitted:
export type GetSellerParams = {
id: string;
};
export type GetSellerQueryResult = {
getSeller: {
id: string;
name: string;
logo: string;
description: string;
};
};
const sellerResolver = {
Query: {
getSeller: async (_: unknown, { id }: GetSellerParams) => {
const url = `https://{account}.vtexcommercestable.com.br/api/seller-register/pvt/sellers/${id}?sc=1`;
const response = await fetch(url, {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"X-VTEX-API-AppKey": "{appKey}",
"X-VTEX-API-AppToken": "{appToken}",
},
});
const data: GetSellerQueryResult["getSeller"] = await response.json();
return data;
},
},
};
export default sellerResolver;