Skip to content

Commit

Permalink
feat: Move graphql endpoitns to .env
Browse files Browse the repository at this point in the history
  • Loading branch information
clockworkgr committed Mar 14, 2024
1 parent fa5dc0f commit d1c79d5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ENDPOINT=http://localhost:3000
STORAGE_KEY=github-comment-jwt
REPO=stuyk/giscus
REPO=stuyk/giscus
VITE_GRAPHQL_ENDPOINT=http://164.92.143.81:8080/v1/graphql
6 changes: 4 additions & 2 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { CodegenConfig } from "@graphql-codegen/cli";

import dotenv from "dotenv";
dotenv.config();
console.log(process);
const config: CodegenConfig = {
schema: "http://164.92.143.81:8080/v1/graphql",
schema: process.env.VITE_GRAPHQL_ENDPOINT ?? "http://164.92.143.81:8080/v1/graphql",
documents: ["src/**/*.graphql"],
generates: {
"./src/gql/": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.17",
"dotenv": "^16.4.5",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IconVue from "./components/ui/Icon.vue";
// HTTP connection to the API
const httpLink = createHttpLink({
// You should use an absolute URL here
uri: "http://164.92.143.81:8080/v1/graphql",
uri: import.meta.env.VITE_GRAPHQL_ENDPOINT ?? "http://164.92.143.81:8080/v1/graphql",
});

// Cache implementation
Expand Down

0 comments on commit d1c79d5

Please sign in to comment.