@monorise/cli 4.1.1 → 4.1.2
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NextRequest } from 'next/server';
|
|
2
|
+
import { Resource } from 'sst';
|
|
2
3
|
|
|
3
4
|
function rewriteUrl({
|
|
4
5
|
requestUrl,
|
|
@@ -39,7 +40,7 @@ export const proxyRequest = async ({
|
|
|
39
40
|
body,
|
|
40
41
|
headers: {
|
|
41
42
|
...reqHeaders,
|
|
42
|
-
'x-api-key':
|
|
43
|
+
'x-api-key': Resource.X_API_KEY.value,
|
|
43
44
|
},
|
|
44
45
|
cache: 'no-store',
|
|
45
46
|
},
|
|
@@ -15,15 +15,16 @@ export default $config({
|
|
|
15
15
|
const { api } = new monorise.module.Core('core', {
|
|
16
16
|
allowOrigins: ['http://localhost:3000'],
|
|
17
17
|
});
|
|
18
|
+
// Must match one entry in Core's API_KEYS secret (defaults to
|
|
19
|
+
// ["secret1", "secret2"]). Override both before deploying:
|
|
20
|
+
// npx sst secret set X_API_KEY '...' && npx sst secret set API_KEYS '["..."]'
|
|
21
|
+
const xApiKey = new sst.Secret('X_API_KEY', 'secret1');
|
|
18
22
|
|
|
19
23
|
new sst.aws.Nextjs('web', {
|
|
20
24
|
path: 'apps/web',
|
|
25
|
+
link: [api, xApiKey],
|
|
21
26
|
environment: {
|
|
22
27
|
API_BASE_URL: api.url,
|
|
23
|
-
// Must match one of the values in the backend's API_KEYS secret
|
|
24
|
-
// (defaults to ["secret1", "secret2"] — override both with
|
|
25
|
-
// `npx sst secret set API_KEYS '["..."]'` before deploying).
|
|
26
|
-
API_KEY: 'secret1',
|
|
27
28
|
},
|
|
28
29
|
});
|
|
29
30
|
},
|