Skip to content

Commit de6cbdc

Browse files
committed
v0.0.50
1 parent 583bdfb commit de6cbdc

File tree

5 files changed

+35
-24
lines changed

5 files changed

+35
-24
lines changed

packages/cli/dist/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gluestack/glue-plugin-auth",
3-
"version": "0.0.49",
3+
"version": "0.0.50",
44
"description": "auth plugin for gluestack",
55
"repository": {
66
"type": "git",
@@ -16,7 +16,7 @@
1616
"@gluestack/glue-plugin-backend-engine": "^0.0.x",
1717
"@gluestack/glue-plugin-graphql": "^0.0.x",
1818
"@gluestack/glue-plugin-sdk": "^0.0.x",
19-
"@gluestack/helpers": "^0.0.x",
19+
"@gluestack/helpers": "^0.0.15",
2020
"@types/node": "^18.11.17"
2121
},
2222
"main": "dist/src/index.js",
@@ -30,7 +30,7 @@
3030
"typescript": "^4.9.4"
3131
},
3232
"peerDependencies": {
33-
"@gluestack/glue-plugin-graphql": "^0.0.x",
34-
"@gluestack/glue-plugin-backend-engine": "^0.0.x"
33+
"@gluestack/glue-plugin-backend-engine": "^0.0.x",
34+
"@gluestack/glue-plugin-graphql": "^0.0.x"
3535
}
3636
}

packages/cli/dist/src/helpers/writeEnv.js

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/dist/src/helpers/writeEnv.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gluestack/glue-plugin-auth",
3-
"version": "0.0.49",
3+
"version": "0.0.50",
44
"description": "auth plugin for gluestack",
55
"repository": {
66
"type": "git",
@@ -16,7 +16,7 @@
1616
"@gluestack/glue-plugin-backend-engine": "^0.0.x",
1717
"@gluestack/glue-plugin-graphql": "^0.0.x",
1818
"@gluestack/glue-plugin-sdk": "^0.0.x",
19-
"@gluestack/helpers": "^0.0.x",
19+
"@gluestack/helpers": "^0.0.15",
2020
"@types/node": "^18.11.17"
2121
},
2222
"main": "dist/src/index.js",
@@ -30,7 +30,7 @@
3030
"typescript": "^4.9.4"
3131
},
3232
"peerDependencies": {
33-
"@gluestack/glue-plugin-graphql": "^0.0.x",
34-
"@gluestack/glue-plugin-backend-engine": "^0.0.x"
33+
"@gluestack/glue-plugin-backend-engine": "^0.0.x",
34+
"@gluestack/glue-plugin-graphql": "^0.0.x"
3535
}
3636
}

packages/cli/src/helpers/writeEnv.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { join } from "path";
33
import { PluginInstance as AuthPluginInstance } from "../PluginInstance";
44
import { PluginInstance as GraphqlPluginInstance } from "@gluestack/glue-plugin-graphql/src/PluginInstance";
55
import IInstance from "@gluestack/framework/types/plugin/interface/IInstance";
6+
import { getCrossEnvKey } from "@gluestack/helpers";
67

78
const { removeSpecialChars } = require("@gluestack/helpers");
89

910
export async function constructEnvFromJson(
1011
authInstance: AuthPluginInstance,
1112
graphqlInstance: GraphqlPluginInstance,
1213
) {
13-
const json = await graphqlInstance.getContainerController().getEnv();
1414
let port = "PORT";
1515
try {
1616
const mappings = require(join(process.cwd(), "router.map.js"))();
@@ -27,12 +27,17 @@ export async function constructEnvFromJson(
2727
REFRESH_TOKEN_SECRET: "refresh-token-secret",
2828
REFRESH_TOKEN_EXPIRES_IN: "30D",
2929
//
30-
HASURA_GRAPHQL_UNAUTHORIZED_ROLE:
31-
json["HASURA_GRAPHQL_UNAUTHORIZED_ROLE"] || "",
30+
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: getEnvKey(
31+
graphqlInstance,
32+
"HASURA_GRAPHQL_UNAUTHORIZED_ROLE",
33+
),
3234
HASURA_GRAPHQL_URL: graphqlInstance.getGraphqlURL(),
33-
HASURA_GRAPHQL_ADMIN_SECRET: json["HASURA_GRAPHQL_ADMIN_SECRET"] || "",
34-
HASURA_GRAPHQL_JWT_SECRET: json["JWT_SECRET"],
35-
HASURA_GRAPHQL_JWT_KEY: json["JWT_KEY"],
35+
HASURA_GRAPHQL_ADMIN_SECRET: getEnvKey(
36+
graphqlInstance,
37+
"HASURA_GRAPHQL_ADMIN_SECRET",
38+
),
39+
HASURA_GRAPHQL_JWT_SECRET: getEnvKey(graphqlInstance, "JWT_SECRET"),
40+
HASURA_GRAPHQL_JWT_KEY: getEnvKey(graphqlInstance, "JWT_KEY"),
3641
HASURA_GRAPHQL_USER_ROLE: "user",
3742
//
3843
AUTH_GOOGLE_CLIENT_ID: "",
@@ -60,3 +65,7 @@ export async function writeEnv(
6065

6166
fs.writeFileSync(path, env);
6267
}
68+
69+
function getEnvKey(graphqlInstance: GraphqlPluginInstance, key: string) {
70+
return `%${getCrossEnvKey(graphqlInstance.getName(), key)}%`;
71+
}

0 commit comments

Comments
 (0)