@appconda/nextjs 1.0.80 → 1.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/actionClient.js +2 -0
- package/dist/actions/auth.d.ts +1 -0
- package/dist/actions/auth.js +5 -0
- package/dist/actions/authOptions.js +6 -4
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/getAppcondaClient.js +4 -4
- package/dist/getSDKForService.js +2 -2
- package/dist/lib/env.d.ts +1 -6
- package/dist/lib/env.js +126 -118
- package/package.json +1 -1
- package/src/actions/actionClient.ts +2 -0
- package/src/actions/auth.ts +6 -0
- package/src/actions/authOptions.ts +6 -4
- package/src/actions/index.ts +2 -1
- package/src/getAppcondaClient.ts +4 -4
- package/src/getSDKForService.ts +2 -2
- package/src/lib/env.ts +131 -118
@@ -25,7 +25,9 @@ export const authenticatedActionClient = actionClient.use(async ({ next }) => {
|
|
25
25
|
if (!session?.user) {
|
26
26
|
throw new AuthenticationError("Not authenticated");
|
27
27
|
}
|
28
|
+
//@ts-ignore
|
28
29
|
const userId = session.user.id;
|
30
|
+
//@ts-ignore
|
29
31
|
const user = await getUser(userId);
|
30
32
|
if (!user) {
|
31
33
|
throw new AuthorizationError("User not found");
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const auth: () => Promise<import("next-auth").Session>;
|
@@ -2,7 +2,7 @@ import CredentialsProvider from "next-auth/providers/credentials";
|
|
2
2
|
import { cookies } from "next/headers";
|
3
3
|
import { getAppcondaClient } from "../getAppcondaClient";
|
4
4
|
import { Account } from "../modules/account/service";
|
5
|
-
import {
|
5
|
+
import { getEnv } from "../lib/env";
|
6
6
|
import { getSDKForCurrentUser } from "../getSDKForCurrentUser";
|
7
7
|
import { Query } from "../query";
|
8
8
|
export async function signIn({ userName, password }) {
|
@@ -169,7 +169,7 @@ export const authOptions = {
|
|
169
169
|
},
|
170
170
|
}),
|
171
171
|
// Conditionally add enterprise SSO providers
|
172
|
-
...(
|
172
|
+
...(getEnv().ENTERPRISE_LICENSE_KEY ? [] : []),
|
173
173
|
],
|
174
174
|
callbacks: {
|
175
175
|
async jwt({ token }) {
|
@@ -183,16 +183,18 @@ export const authOptions = {
|
|
183
183
|
} */
|
184
184
|
return {
|
185
185
|
...token,
|
186
|
+
//@ts-ignore
|
186
187
|
profile: { id: user.$id, ...user },
|
187
188
|
};
|
188
189
|
},
|
189
190
|
async session({ session, token }) {
|
190
|
-
|
191
|
+
//@ts-ignore
|
191
192
|
session.user.id = token?.id;
|
192
|
-
|
193
|
+
//@ts-ignore
|
193
194
|
session.user = token.profile;
|
194
195
|
return session;
|
195
196
|
},
|
197
|
+
//@ts-ignore
|
196
198
|
async signIn({ user, account }) {
|
197
199
|
/* if (account?.provider === "credentials" || account?.provider === "token") {
|
198
200
|
// check if user's email is verified or not
|
package/dist/actions/index.d.ts
CHANGED
package/dist/actions/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Client } from "./client";
|
2
|
-
import {
|
2
|
+
import { getEnv } from "./lib/env";
|
3
3
|
function getPortAndHostname(urlString) {
|
4
4
|
try {
|
5
5
|
const url = new URL(urlString);
|
@@ -16,8 +16,8 @@ function getPortAndHostname(urlString) {
|
|
16
16
|
}
|
17
17
|
export async function getAppcondaClient() {
|
18
18
|
let url;
|
19
|
-
if (
|
20
|
-
url =
|
19
|
+
if (getEnv().APPCONDA_ENDPOINT) {
|
20
|
+
url = getEnv().APPCONDA_ENDPOINT;
|
21
21
|
}
|
22
22
|
else if (typeof window !== 'undefined') {
|
23
23
|
const hostInfo = getPortAndHostname(window.location.href);
|
@@ -29,7 +29,7 @@ export async function getAppcondaClient() {
|
|
29
29
|
}
|
30
30
|
}
|
31
31
|
else {
|
32
|
-
url =
|
32
|
+
url = getEnv().APPCONDA_ENDPOINT || 'http://appconda/v1';
|
33
33
|
}
|
34
34
|
/* if (ApplicationConfig.Port == null) {
|
35
35
|
url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}:${ApplicationConfig.Port}/v1`
|
package/dist/getSDKForService.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import { getAppcondaClient } from "./getAppcondaClient";
|
2
|
-
import {
|
2
|
+
import { getEnv } from "./lib/env";
|
3
3
|
import { WaitlistService } from "./modules";
|
4
4
|
import { Configuration } from "./services/configuration";
|
5
5
|
export async function getSDKForService() {
|
6
6
|
const adminClient = await getAppcondaClient();
|
7
|
-
adminClient.addHeader('x-service-token',
|
7
|
+
adminClient.addHeader('x-service-token', getEnv()._SERVICE_TOKEN ?? '');
|
8
8
|
/*
|
9
9
|
const accounts = new Account(adminClient);
|
10
10
|
const databases = new Databases(adminClient);
|
package/dist/lib/env.d.ts
CHANGED
package/dist/lib/env.js
CHANGED
@@ -1,120 +1,128 @@
|
|
1
1
|
import { createEnv } from "@t3-oss/env-nextjs";
|
2
2
|
import { z } from "zod";
|
3
|
-
export const
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
3
|
+
export const getEnv = (() => {
|
4
|
+
let env = null;
|
5
|
+
return () => {
|
6
|
+
if (env == null) {
|
7
|
+
env = createEnv({
|
8
|
+
/*
|
9
|
+
* Serverside Environment variables, not available on the client.
|
10
|
+
* Will throw if you access these variables on the client.
|
11
|
+
*/
|
12
|
+
server: {
|
13
|
+
APPCONDA_ENDPOINT: z.string(),
|
14
|
+
APPCONDA_CLIENT_ENDPOINT: z.string(),
|
15
|
+
_SERVICE_TOKEN: z.string(),
|
16
|
+
ENTERPRISE_LICENSE_KEY: z.string(),
|
17
|
+
/* AI_AZURE_LLM_API_KEY: z.string().optional(),
|
18
|
+
AI_AZURE_EMBEDDINGS_DEPLOYMENT_ID: z.string().optional(),
|
19
|
+
AI_AZURE_LLM_DEPLOYMENT_ID: z.string().optional(),
|
20
|
+
AI_AZURE_EMBEDDINGS_RESSOURCE_NAME: z.string().optional(),
|
21
|
+
AI_AZURE_LLM_RESSOURCE_NAME: z.string().optional(),
|
22
|
+
AIRTABLE_CLIENT_ID: z.string().optional(),
|
23
|
+
AZUREAD_CLIENT_ID: z.string().optional(),
|
24
|
+
AZUREAD_CLIENT_SECRET: z.string().optional(),
|
25
|
+
AZUREAD_TENANT_ID: z.string().optional(),
|
26
|
+
CRON_SECRET: z.string().min(10),
|
27
|
+
CUSTOMER_IO_API_KEY: z.string().optional(),
|
28
|
+
CUSTOMER_IO_SITE_ID: z.string().optional(),
|
29
|
+
DATABASE_URL: z.string().url(),
|
30
|
+
DEBUG: z.enum(["1", "0"]).optional(),
|
31
|
+
DEFAULT_ORGANIZATION_ID: z.string().optional(),
|
32
|
+
DEFAULT_ORGANIZATION_ROLE: z.enum(["owner", "manager", "member", "billing"]).optional(),
|
33
|
+
E2E_TESTING: z.enum(["1", "0"]).optional(),
|
34
|
+
EMAIL_AUTH_DISABLED: z.enum(["1", "0"]).optional(),
|
35
|
+
EMAIL_VERIFICATION_DISABLED: z.enum(["1", "0"]).optional(),
|
36
|
+
ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
|
37
|
+
ENTERPRISE_LICENSE_KEY: z.string().optional(),
|
38
|
+
FORMBRICKS_ENCRYPTION_KEY: z.string().length(24).or(z.string().length(0)).optional(),
|
39
|
+
GITHUB_ID: z.string().optional(),
|
40
|
+
GITHUB_SECRET: z.string().optional(),
|
41
|
+
GOOGLE_CLIENT_ID: z.string().optional(),
|
42
|
+
GOOGLE_CLIENT_SECRET: z.string().optional(),
|
43
|
+
GOOGLE_SHEETS_CLIENT_ID: z.string().optional(),
|
44
|
+
GOOGLE_SHEETS_CLIENT_SECRET: z.string().optional(),
|
45
|
+
GOOGLE_SHEETS_REDIRECT_URL: z.string().optional(),
|
46
|
+
HTTP_PROXY: z.string().url().optional(),
|
47
|
+
HTTPS_PROXY: z.string().url().optional(),
|
48
|
+
IMPRINT_URL: z
|
49
|
+
.string()
|
50
|
+
.url()
|
51
|
+
.optional()
|
52
|
+
.or(z.string().refine((str) => str === "")),
|
53
|
+
IMPRINT_ADDRESS: z.string().optional(),
|
54
|
+
INVITE_DISABLED: z.enum(["1", "0"]).optional(),
|
55
|
+
INTERCOM_SECRET_KEY: z.string().optional(),
|
56
|
+
IS_FORMBRICKS_CLOUD: z.enum(["1", "0"]).optional(),
|
57
|
+
MAIL_FROM: z.string().email().optional(),
|
58
|
+
NEXTAUTH_SECRET: z.string().min(1),
|
59
|
+
NOTION_OAUTH_CLIENT_ID: z.string().optional(),
|
60
|
+
NOTION_OAUTH_CLIENT_SECRET: z.string().optional(),
|
61
|
+
OIDC_CLIENT_ID: z.string().optional(),
|
62
|
+
OIDC_CLIENT_SECRET: z.string().optional(),
|
63
|
+
OIDC_DISPLAY_NAME: z.string().optional(),
|
64
|
+
OIDC_ISSUER: z.string().optional(),
|
65
|
+
OIDC_SIGNING_ALGORITHM: z.string().optional(),
|
66
|
+
OPENTELEMETRY_LISTENER_URL: z.string().optional(),
|
67
|
+
REDIS_URL: z.string().optional(),
|
68
|
+
REDIS_HTTP_URL: z.string().optional(),
|
69
|
+
PASSWORD_RESET_DISABLED: z.enum(["1", "0"]).optional(),
|
70
|
+
PRIVACY_URL: z
|
71
|
+
.string()
|
72
|
+
.url()
|
73
|
+
.optional()
|
74
|
+
.or(z.string().refine((str) => str === "")),
|
75
|
+
RATE_LIMITING_DISABLED: z.enum(["1", "0"]).optional(),
|
76
|
+
S3_ACCESS_KEY: z.string().optional(),
|
77
|
+
S3_BUCKET_NAME: z.string().optional(),
|
78
|
+
S3_REGION: z.string().optional(),
|
79
|
+
S3_SECRET_KEY: z.string().optional(),
|
80
|
+
S3_ENDPOINT_URL: z.string().optional(),
|
81
|
+
S3_FORCE_PATH_STYLE: z.enum(["1", "0"]).optional(),
|
82
|
+
SHORT_URL_BASE: z.string().url().optional().or(z.string().length(0)),
|
83
|
+
SIGNUP_DISABLED: z.enum(["1", "0"]).optional(),
|
84
|
+
SLACK_CLIENT_ID: z.string().optional(),
|
85
|
+
SLACK_CLIENT_SECRET: z.string().optional(),
|
86
|
+
SMTP_HOST: z.string().min(1).optional(),
|
87
|
+
SMTP_PORT: z.string().min(1).optional(),
|
88
|
+
SMTP_SECURE_ENABLED: z.enum(["1", "0"]).optional(),
|
89
|
+
SMTP_USER: z.string().min(1).optional(),
|
90
|
+
SMTP_PASSWORD: z.string().min(1).optional(),
|
91
|
+
SMTP_AUTHENTICATED: z.enum(["1", "0"]).optional(),
|
92
|
+
SMTP_REJECT_UNAUTHORIZED_TLS: z.enum(["1", "0"]).optional(),
|
93
|
+
STRIPE_SECRET_KEY: z.string().optional(),
|
94
|
+
STRIPE_WEBHOOK_SECRET: z.string().optional(),
|
95
|
+
TELEMETRY_DISABLED: z.enum(["1", "0"]).optional(),
|
96
|
+
TERMS_URL: z
|
97
|
+
.string()
|
98
|
+
.url()
|
99
|
+
.optional()
|
100
|
+
.or(z.string().refine((str) => str === "")),
|
101
|
+
TURNSTILE_SECRET_KEY: z.string().optional(),
|
102
|
+
UPLOADS_DIR: z.string().min(1).optional(),
|
103
|
+
VERCEL_URL: z.string().optional(),
|
104
|
+
_ADMIN_DOMAIN: z.string().optional(),
|
105
|
+
ADMIN_URL: z.string().url().optional(),
|
106
|
+
UNSPLASH_ACCESS_KEY: z.string().optional(),
|
107
|
+
LANGFUSE_SECRET_KEY: z.string().optional(),
|
108
|
+
LANGFUSE_PUBLIC_KEY: z.string().optional(),
|
109
|
+
LANGFUSE_BASEURL: z.string().optional(), */
|
110
|
+
},
|
111
|
+
/*
|
112
|
+
* Due to how Next.js bundles environment variables on Edge and Client,
|
113
|
+
* we need to manually destructure them to make sure all are included in bundle.
|
114
|
+
*
|
115
|
+
* 💡 You'll get type errors if not all variables from `server` & `client` are included here.
|
116
|
+
*/
|
117
|
+
runtimeEnv: {
|
118
|
+
APPCONDA_ENDPOINT: typeof window !== 'undefined' ? process.env.APPCONDA_ENDPOINT : "",
|
119
|
+
APPCONDA_CLIENT_ENDPOINT: typeof window !== 'undefined' ? process.env.APPCONDA_CLIENT_ENDPOINT : "",
|
120
|
+
_SERVICE_TOKEN: typeof window !== 'undefined' ? process.env._SERVICE_TOKEN : "",
|
121
|
+
ENTERPRISE_LICENSE_KEY: typeof window !== 'undefined' ? process.env.ENTERPRISE_LICENSE_KEY : "",
|
122
|
+
},
|
123
|
+
});
|
124
|
+
console.log(env);
|
125
|
+
}
|
126
|
+
return env;
|
127
|
+
};
|
128
|
+
})();
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@appconda/nextjs",
|
3
3
|
"homepage": "https://appconda.io/support",
|
4
4
|
"description": "Appconda is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
5
|
-
"version": "1.0.
|
5
|
+
"version": "1.0.82",
|
6
6
|
"license": "BSD-3-Clause",
|
7
7
|
"main": "dist/index.js",
|
8
8
|
"types": "dist/index.d.ts",
|
@@ -32,8 +32,10 @@ export const authenticatedActionClient = actionClient.use(async ({ next }) => {
|
|
32
32
|
throw new AuthenticationError("Not authenticated");
|
33
33
|
}
|
34
34
|
|
35
|
+
//@ts-ignore
|
35
36
|
const userId = session.user.id;
|
36
37
|
|
38
|
+
//@ts-ignore
|
37
39
|
const user = await getUser(userId);
|
38
40
|
if (!user) {
|
39
41
|
throw new AuthorizationError("User not found");
|
@@ -3,7 +3,7 @@ import CredentialsProvider from "next-auth/providers/credentials";
|
|
3
3
|
import { cookies } from "next/headers";
|
4
4
|
import { getAppcondaClient } from "../getAppcondaClient";
|
5
5
|
import { Account } from "../modules/account/service";
|
6
|
-
import {
|
6
|
+
import { getEnv } from "../lib/env";
|
7
7
|
import { getSDKForCurrentUser } from "../getSDKForCurrentUser";
|
8
8
|
import { Query } from "../query";
|
9
9
|
|
@@ -184,7 +184,7 @@ export const authOptions: NextAuthOptions = {
|
|
184
184
|
},
|
185
185
|
}),
|
186
186
|
// Conditionally add enterprise SSO providers
|
187
|
-
...(
|
187
|
+
...(getEnv().ENTERPRISE_LICENSE_KEY ? [] : []),
|
188
188
|
],
|
189
189
|
callbacks: {
|
190
190
|
async jwt({ token }) {
|
@@ -202,17 +202,19 @@ export const authOptions: NextAuthOptions = {
|
|
202
202
|
|
203
203
|
return {
|
204
204
|
...token,
|
205
|
+
//@ts-ignore
|
205
206
|
profile: { id: user.$id, ...user },
|
206
207
|
};
|
207
208
|
},
|
208
209
|
async session({ session, token }) {
|
209
|
-
|
210
|
+
//@ts-ignore
|
210
211
|
session.user.id = token?.id;
|
211
|
-
|
212
|
+
//@ts-ignore
|
212
213
|
session.user = token.profile;
|
213
214
|
|
214
215
|
return session;
|
215
216
|
},
|
217
|
+
//@ts-ignore
|
216
218
|
async signIn({ user, account }: { user: any; account: Account | null }) {
|
217
219
|
/* if (account?.provider === "credentials" || account?.provider === "token") {
|
218
220
|
// check if user's email is verified or not
|
package/src/actions/index.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export * from "./actionClient";
|
1
|
+
export * from "./actionClient";
|
2
|
+
export * from "./auth";
|
package/src/getAppcondaClient.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Client } from "./client";
|
2
|
-
import {
|
2
|
+
import { getEnv } from "./lib/env";
|
3
3
|
|
4
4
|
function getPortAndHostname(urlString: string): { hostname: string; port: string; protocol: string } {
|
5
5
|
try {
|
@@ -18,8 +18,8 @@ function getPortAndHostname(urlString: string): { hostname: string; port: string
|
|
18
18
|
export async function getAppcondaClient() {
|
19
19
|
|
20
20
|
let url;
|
21
|
-
if (
|
22
|
-
url =
|
21
|
+
if (getEnv().APPCONDA_ENDPOINT) {
|
22
|
+
url = getEnv().APPCONDA_ENDPOINT;
|
23
23
|
} else if (typeof window !== 'undefined') {
|
24
24
|
const hostInfo = getPortAndHostname(window.location.href);
|
25
25
|
if (hostInfo.port) {
|
@@ -28,7 +28,7 @@ export async function getAppcondaClient() {
|
|
28
28
|
url = `${hostInfo.protocol}//${hostInfo.hostname}/v1`
|
29
29
|
}
|
30
30
|
} else {
|
31
|
-
url =
|
31
|
+
url = getEnv().APPCONDA_ENDPOINT || 'http://appconda/v1'
|
32
32
|
}
|
33
33
|
|
34
34
|
/* if (ApplicationConfig.Port == null) {
|
package/src/getSDKForService.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { getAppcondaClient } from "./getAppcondaClient";
|
2
|
-
import {
|
2
|
+
import { getEnv } from "./lib/env";
|
3
3
|
import { WaitlistService } from "./modules";
|
4
4
|
import { Configuration } from "./services/configuration";
|
5
5
|
|
6
6
|
export async function getSDKForService() {
|
7
7
|
const adminClient = await getAppcondaClient();
|
8
8
|
|
9
|
-
adminClient.addHeader('x-service-token',
|
9
|
+
adminClient.addHeader('x-service-token', getEnv()._SERVICE_TOKEN ?? '');
|
10
10
|
/*
|
11
11
|
const accounts = new Account(adminClient);
|
12
12
|
const databases = new Databases(adminClient);
|
package/src/lib/env.ts
CHANGED
@@ -1,124 +1,137 @@
|
|
1
1
|
import { createEnv } from "@t3-oss/env-nextjs";
|
2
2
|
import { z } from "zod";
|
3
3
|
|
4
|
-
export const env = createEnv({
|
5
|
-
/*
|
6
|
-
* Serverside Environment variables, not available on the client.
|
7
|
-
* Will throw if you access these variables on the client.
|
8
|
-
*/
|
9
|
-
server: {
|
10
|
-
APPCONDA_ENDPOINT: z.string(),
|
11
|
-
APPCONDA_CLIENT_ENDPOINT: z.string(),
|
12
|
-
_SERVICE_TOKEN: z.string(),
|
13
|
-
ENTERPRISE_LICENSE_KEY: z.string(),
|
14
|
-
/* AI_AZURE_LLM_API_KEY: z.string().optional(),
|
15
|
-
AI_AZURE_EMBEDDINGS_DEPLOYMENT_ID: z.string().optional(),
|
16
|
-
AI_AZURE_LLM_DEPLOYMENT_ID: z.string().optional(),
|
17
|
-
AI_AZURE_EMBEDDINGS_RESSOURCE_NAME: z.string().optional(),
|
18
|
-
AI_AZURE_LLM_RESSOURCE_NAME: z.string().optional(),
|
19
|
-
AIRTABLE_CLIENT_ID: z.string().optional(),
|
20
|
-
AZUREAD_CLIENT_ID: z.string().optional(),
|
21
|
-
AZUREAD_CLIENT_SECRET: z.string().optional(),
|
22
|
-
AZUREAD_TENANT_ID: z.string().optional(),
|
23
|
-
CRON_SECRET: z.string().min(10),
|
24
|
-
CUSTOMER_IO_API_KEY: z.string().optional(),
|
25
|
-
CUSTOMER_IO_SITE_ID: z.string().optional(),
|
26
|
-
DATABASE_URL: z.string().url(),
|
27
|
-
DEBUG: z.enum(["1", "0"]).optional(),
|
28
|
-
DEFAULT_ORGANIZATION_ID: z.string().optional(),
|
29
|
-
DEFAULT_ORGANIZATION_ROLE: z.enum(["owner", "manager", "member", "billing"]).optional(),
|
30
|
-
E2E_TESTING: z.enum(["1", "0"]).optional(),
|
31
|
-
EMAIL_AUTH_DISABLED: z.enum(["1", "0"]).optional(),
|
32
|
-
EMAIL_VERIFICATION_DISABLED: z.enum(["1", "0"]).optional(),
|
33
|
-
ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
|
34
|
-
ENTERPRISE_LICENSE_KEY: z.string().optional(),
|
35
|
-
FORMBRICKS_ENCRYPTION_KEY: z.string().length(24).or(z.string().length(0)).optional(),
|
36
|
-
GITHUB_ID: z.string().optional(),
|
37
|
-
GITHUB_SECRET: z.string().optional(),
|
38
|
-
GOOGLE_CLIENT_ID: z.string().optional(),
|
39
|
-
GOOGLE_CLIENT_SECRET: z.string().optional(),
|
40
|
-
GOOGLE_SHEETS_CLIENT_ID: z.string().optional(),
|
41
|
-
GOOGLE_SHEETS_CLIENT_SECRET: z.string().optional(),
|
42
|
-
GOOGLE_SHEETS_REDIRECT_URL: z.string().optional(),
|
43
|
-
HTTP_PROXY: z.string().url().optional(),
|
44
|
-
HTTPS_PROXY: z.string().url().optional(),
|
45
|
-
IMPRINT_URL: z
|
46
|
-
.string()
|
47
|
-
.url()
|
48
|
-
.optional()
|
49
|
-
.or(z.string().refine((str) => str === "")),
|
50
|
-
IMPRINT_ADDRESS: z.string().optional(),
|
51
|
-
INVITE_DISABLED: z.enum(["1", "0"]).optional(),
|
52
|
-
INTERCOM_SECRET_KEY: z.string().optional(),
|
53
|
-
IS_FORMBRICKS_CLOUD: z.enum(["1", "0"]).optional(),
|
54
|
-
MAIL_FROM: z.string().email().optional(),
|
55
|
-
NEXTAUTH_SECRET: z.string().min(1),
|
56
|
-
NOTION_OAUTH_CLIENT_ID: z.string().optional(),
|
57
|
-
NOTION_OAUTH_CLIENT_SECRET: z.string().optional(),
|
58
|
-
OIDC_CLIENT_ID: z.string().optional(),
|
59
|
-
OIDC_CLIENT_SECRET: z.string().optional(),
|
60
|
-
OIDC_DISPLAY_NAME: z.string().optional(),
|
61
|
-
OIDC_ISSUER: z.string().optional(),
|
62
|
-
OIDC_SIGNING_ALGORITHM: z.string().optional(),
|
63
|
-
OPENTELEMETRY_LISTENER_URL: z.string().optional(),
|
64
|
-
REDIS_URL: z.string().optional(),
|
65
|
-
REDIS_HTTP_URL: z.string().optional(),
|
66
|
-
PASSWORD_RESET_DISABLED: z.enum(["1", "0"]).optional(),
|
67
|
-
PRIVACY_URL: z
|
68
|
-
.string()
|
69
|
-
.url()
|
70
|
-
.optional()
|
71
|
-
.or(z.string().refine((str) => str === "")),
|
72
|
-
RATE_LIMITING_DISABLED: z.enum(["1", "0"]).optional(),
|
73
|
-
S3_ACCESS_KEY: z.string().optional(),
|
74
|
-
S3_BUCKET_NAME: z.string().optional(),
|
75
|
-
S3_REGION: z.string().optional(),
|
76
|
-
S3_SECRET_KEY: z.string().optional(),
|
77
|
-
S3_ENDPOINT_URL: z.string().optional(),
|
78
|
-
S3_FORCE_PATH_STYLE: z.enum(["1", "0"]).optional(),
|
79
|
-
SHORT_URL_BASE: z.string().url().optional().or(z.string().length(0)),
|
80
|
-
SIGNUP_DISABLED: z.enum(["1", "0"]).optional(),
|
81
|
-
SLACK_CLIENT_ID: z.string().optional(),
|
82
|
-
SLACK_CLIENT_SECRET: z.string().optional(),
|
83
|
-
SMTP_HOST: z.string().min(1).optional(),
|
84
|
-
SMTP_PORT: z.string().min(1).optional(),
|
85
|
-
SMTP_SECURE_ENABLED: z.enum(["1", "0"]).optional(),
|
86
|
-
SMTP_USER: z.string().min(1).optional(),
|
87
|
-
SMTP_PASSWORD: z.string().min(1).optional(),
|
88
|
-
SMTP_AUTHENTICATED: z.enum(["1", "0"]).optional(),
|
89
|
-
SMTP_REJECT_UNAUTHORIZED_TLS: z.enum(["1", "0"]).optional(),
|
90
|
-
STRIPE_SECRET_KEY: z.string().optional(),
|
91
|
-
STRIPE_WEBHOOK_SECRET: z.string().optional(),
|
92
|
-
TELEMETRY_DISABLED: z.enum(["1", "0"]).optional(),
|
93
|
-
TERMS_URL: z
|
94
|
-
.string()
|
95
|
-
.url()
|
96
|
-
.optional()
|
97
|
-
.or(z.string().refine((str) => str === "")),
|
98
|
-
TURNSTILE_SECRET_KEY: z.string().optional(),
|
99
|
-
UPLOADS_DIR: z.string().min(1).optional(),
|
100
|
-
VERCEL_URL: z.string().optional(),
|
101
|
-
_ADMIN_DOMAIN: z.string().optional(),
|
102
|
-
ADMIN_URL: z.string().url().optional(),
|
103
|
-
UNSPLASH_ACCESS_KEY: z.string().optional(),
|
104
|
-
LANGFUSE_SECRET_KEY: z.string().optional(),
|
105
|
-
LANGFUSE_PUBLIC_KEY: z.string().optional(),
|
106
|
-
LANGFUSE_BASEURL: z.string().optional(), */
|
107
|
-
},
|
108
4
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
5
|
+
export const getEnv = (() => {
|
6
|
+
let env = null;
|
7
|
+
return () => {
|
8
|
+
if (env == null) {
|
9
|
+
env = createEnv({
|
10
|
+
/*
|
11
|
+
* Serverside Environment variables, not available on the client.
|
12
|
+
* Will throw if you access these variables on the client.
|
13
|
+
*/
|
14
|
+
server: {
|
15
|
+
APPCONDA_ENDPOINT: z.string(),
|
16
|
+
APPCONDA_CLIENT_ENDPOINT: z.string(),
|
17
|
+
_SERVICE_TOKEN: z.string(),
|
18
|
+
ENTERPRISE_LICENSE_KEY: z.string(),
|
19
|
+
/* AI_AZURE_LLM_API_KEY: z.string().optional(),
|
20
|
+
AI_AZURE_EMBEDDINGS_DEPLOYMENT_ID: z.string().optional(),
|
21
|
+
AI_AZURE_LLM_DEPLOYMENT_ID: z.string().optional(),
|
22
|
+
AI_AZURE_EMBEDDINGS_RESSOURCE_NAME: z.string().optional(),
|
23
|
+
AI_AZURE_LLM_RESSOURCE_NAME: z.string().optional(),
|
24
|
+
AIRTABLE_CLIENT_ID: z.string().optional(),
|
25
|
+
AZUREAD_CLIENT_ID: z.string().optional(),
|
26
|
+
AZUREAD_CLIENT_SECRET: z.string().optional(),
|
27
|
+
AZUREAD_TENANT_ID: z.string().optional(),
|
28
|
+
CRON_SECRET: z.string().min(10),
|
29
|
+
CUSTOMER_IO_API_KEY: z.string().optional(),
|
30
|
+
CUSTOMER_IO_SITE_ID: z.string().optional(),
|
31
|
+
DATABASE_URL: z.string().url(),
|
32
|
+
DEBUG: z.enum(["1", "0"]).optional(),
|
33
|
+
DEFAULT_ORGANIZATION_ID: z.string().optional(),
|
34
|
+
DEFAULT_ORGANIZATION_ROLE: z.enum(["owner", "manager", "member", "billing"]).optional(),
|
35
|
+
E2E_TESTING: z.enum(["1", "0"]).optional(),
|
36
|
+
EMAIL_AUTH_DISABLED: z.enum(["1", "0"]).optional(),
|
37
|
+
EMAIL_VERIFICATION_DISABLED: z.enum(["1", "0"]).optional(),
|
38
|
+
ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
|
39
|
+
ENTERPRISE_LICENSE_KEY: z.string().optional(),
|
40
|
+
FORMBRICKS_ENCRYPTION_KEY: z.string().length(24).or(z.string().length(0)).optional(),
|
41
|
+
GITHUB_ID: z.string().optional(),
|
42
|
+
GITHUB_SECRET: z.string().optional(),
|
43
|
+
GOOGLE_CLIENT_ID: z.string().optional(),
|
44
|
+
GOOGLE_CLIENT_SECRET: z.string().optional(),
|
45
|
+
GOOGLE_SHEETS_CLIENT_ID: z.string().optional(),
|
46
|
+
GOOGLE_SHEETS_CLIENT_SECRET: z.string().optional(),
|
47
|
+
GOOGLE_SHEETS_REDIRECT_URL: z.string().optional(),
|
48
|
+
HTTP_PROXY: z.string().url().optional(),
|
49
|
+
HTTPS_PROXY: z.string().url().optional(),
|
50
|
+
IMPRINT_URL: z
|
51
|
+
.string()
|
52
|
+
.url()
|
53
|
+
.optional()
|
54
|
+
.or(z.string().refine((str) => str === "")),
|
55
|
+
IMPRINT_ADDRESS: z.string().optional(),
|
56
|
+
INVITE_DISABLED: z.enum(["1", "0"]).optional(),
|
57
|
+
INTERCOM_SECRET_KEY: z.string().optional(),
|
58
|
+
IS_FORMBRICKS_CLOUD: z.enum(["1", "0"]).optional(),
|
59
|
+
MAIL_FROM: z.string().email().optional(),
|
60
|
+
NEXTAUTH_SECRET: z.string().min(1),
|
61
|
+
NOTION_OAUTH_CLIENT_ID: z.string().optional(),
|
62
|
+
NOTION_OAUTH_CLIENT_SECRET: z.string().optional(),
|
63
|
+
OIDC_CLIENT_ID: z.string().optional(),
|
64
|
+
OIDC_CLIENT_SECRET: z.string().optional(),
|
65
|
+
OIDC_DISPLAY_NAME: z.string().optional(),
|
66
|
+
OIDC_ISSUER: z.string().optional(),
|
67
|
+
OIDC_SIGNING_ALGORITHM: z.string().optional(),
|
68
|
+
OPENTELEMETRY_LISTENER_URL: z.string().optional(),
|
69
|
+
REDIS_URL: z.string().optional(),
|
70
|
+
REDIS_HTTP_URL: z.string().optional(),
|
71
|
+
PASSWORD_RESET_DISABLED: z.enum(["1", "0"]).optional(),
|
72
|
+
PRIVACY_URL: z
|
73
|
+
.string()
|
74
|
+
.url()
|
75
|
+
.optional()
|
76
|
+
.or(z.string().refine((str) => str === "")),
|
77
|
+
RATE_LIMITING_DISABLED: z.enum(["1", "0"]).optional(),
|
78
|
+
S3_ACCESS_KEY: z.string().optional(),
|
79
|
+
S3_BUCKET_NAME: z.string().optional(),
|
80
|
+
S3_REGION: z.string().optional(),
|
81
|
+
S3_SECRET_KEY: z.string().optional(),
|
82
|
+
S3_ENDPOINT_URL: z.string().optional(),
|
83
|
+
S3_FORCE_PATH_STYLE: z.enum(["1", "0"]).optional(),
|
84
|
+
SHORT_URL_BASE: z.string().url().optional().or(z.string().length(0)),
|
85
|
+
SIGNUP_DISABLED: z.enum(["1", "0"]).optional(),
|
86
|
+
SLACK_CLIENT_ID: z.string().optional(),
|
87
|
+
SLACK_CLIENT_SECRET: z.string().optional(),
|
88
|
+
SMTP_HOST: z.string().min(1).optional(),
|
89
|
+
SMTP_PORT: z.string().min(1).optional(),
|
90
|
+
SMTP_SECURE_ENABLED: z.enum(["1", "0"]).optional(),
|
91
|
+
SMTP_USER: z.string().min(1).optional(),
|
92
|
+
SMTP_PASSWORD: z.string().min(1).optional(),
|
93
|
+
SMTP_AUTHENTICATED: z.enum(["1", "0"]).optional(),
|
94
|
+
SMTP_REJECT_UNAUTHORIZED_TLS: z.enum(["1", "0"]).optional(),
|
95
|
+
STRIPE_SECRET_KEY: z.string().optional(),
|
96
|
+
STRIPE_WEBHOOK_SECRET: z.string().optional(),
|
97
|
+
TELEMETRY_DISABLED: z.enum(["1", "0"]).optional(),
|
98
|
+
TERMS_URL: z
|
99
|
+
.string()
|
100
|
+
.url()
|
101
|
+
.optional()
|
102
|
+
.or(z.string().refine((str) => str === "")),
|
103
|
+
TURNSTILE_SECRET_KEY: z.string().optional(),
|
104
|
+
UPLOADS_DIR: z.string().min(1).optional(),
|
105
|
+
VERCEL_URL: z.string().optional(),
|
106
|
+
_ADMIN_DOMAIN: z.string().optional(),
|
107
|
+
ADMIN_URL: z.string().url().optional(),
|
108
|
+
UNSPLASH_ACCESS_KEY: z.string().optional(),
|
109
|
+
LANGFUSE_SECRET_KEY: z.string().optional(),
|
110
|
+
LANGFUSE_PUBLIC_KEY: z.string().optional(),
|
111
|
+
LANGFUSE_BASEURL: z.string().optional(), */
|
112
|
+
},
|
113
|
+
|
114
|
+
/*
|
115
|
+
* Due to how Next.js bundles environment variables on Edge and Client,
|
116
|
+
* we need to manually destructure them to make sure all are included in bundle.
|
117
|
+
*
|
118
|
+
* 💡 You'll get type errors if not all variables from `server` & `client` are included here.
|
119
|
+
*/
|
120
|
+
runtimeEnv: {
|
121
|
+
APPCONDA_ENDPOINT: typeof window !== 'undefined' ? process.env.APPCONDA_ENDPOINT : "",
|
122
|
+
APPCONDA_CLIENT_ENDPOINT: typeof window !== 'undefined' ? process.env.APPCONDA_CLIENT_ENDPOINT : "",
|
123
|
+
_SERVICE_TOKEN: typeof window !== 'undefined' ? process.env._SERVICE_TOKEN : "",
|
124
|
+
ENTERPRISE_LICENSE_KEY: typeof window !== 'undefined' ? process.env.ENTERPRISE_LICENSE_KEY : "",
|
125
|
+
},
|
126
|
+
});
|
127
|
+
console.log(env);
|
128
|
+
}
|
129
|
+
|
130
|
+
return env;
|
131
|
+
|
132
|
+
};
|
133
|
+
})();
|
134
|
+
|
135
|
+
|
122
136
|
|
123
137
|
|
124
|
-
console.log(env);
|