@fabrika/provider-cloudflare 0.0.14 → 0.0.15
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/package.json +6 -6
- package/src/command.ts +1 -1
- package/src/control.ts +3 -3
- package/src/proxy-worker.ts +2 -2
- package/src/proxy.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/provider-cloudflare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"test": "bun test"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fabrika/auth": "^0.0.
|
|
40
|
-
"@fabrika/engine": "^0.0.
|
|
41
|
-
"@fabrika/proxy-core": "^0.0.
|
|
42
|
-
"@fabrika/proxy-contract": "^0.0.
|
|
43
|
-
"@fabrika/provider-contract": "^0.0.
|
|
39
|
+
"@fabrika/auth": "^0.0.15",
|
|
40
|
+
"@fabrika/engine": "^0.0.15",
|
|
41
|
+
"@fabrika/proxy-core": "^0.0.15",
|
|
42
|
+
"@fabrika/proxy-contract": "^0.0.15",
|
|
43
|
+
"@fabrika/provider-contract": "^0.0.15",
|
|
44
44
|
"oblaka-iac": "^0.0.18"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/command.ts
CHANGED
|
@@ -81,7 +81,7 @@ export const deployCloudflareConfig = async (options: CloudflareCommandDeployOpt
|
|
|
81
81
|
checkpoint: async () => {},
|
|
82
82
|
}
|
|
83
83
|
const domain = environmentValue('FABRIKA_CONTROL_DOMAIN')
|
|
84
|
-
const iamUrl = environmentValue('
|
|
84
|
+
const iamUrl = environmentValue('FABRIKA_IAM_ISSUER')
|
|
85
85
|
const iamProvisioningKey = environmentValue('FABRIKA_IAM_PROVISIONING_KEY')
|
|
86
86
|
const returnOrigins = parseReturnOrigins(environmentValue('FABRIKA_IAM_RETURN_ORIGINS'))
|
|
87
87
|
const run: RuntimeProviderRun = {
|
package/src/control.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface CloudflareRunnerJob {
|
|
|
60
60
|
readonly credentials: {
|
|
61
61
|
readonly CLOUDFLARE_ACCOUNT_ID: string
|
|
62
62
|
readonly CLOUDFLARE_API_TOKEN: string
|
|
63
|
-
readonly
|
|
63
|
+
readonly FABRIKA_IAM_ISSUER?: string
|
|
64
64
|
readonly FABRIKA_IAM_PROVISIONING_KEY?: string
|
|
65
65
|
}
|
|
66
66
|
readonly secrets?: Readonly<Record<string, string>>
|
|
@@ -118,7 +118,7 @@ export const isCloudflareRunnerJob = (value: unknown): value is CloudflareRunner
|
|
|
118
118
|
return false
|
|
119
119
|
}
|
|
120
120
|
if (
|
|
121
|
-
('
|
|
121
|
+
('FABRIKA_IAM_ISSUER' in credentials && credentials.FABRIKA_IAM_ISSUER !== undefined && typeof credentials.FABRIKA_IAM_ISSUER !== 'string')
|
|
122
122
|
|| ('FABRIKA_IAM_PROVISIONING_KEY' in credentials
|
|
123
123
|
&& credentials.FABRIKA_IAM_PROVISIONING_KEY !== undefined
|
|
124
124
|
&& typeof credentials.FABRIKA_IAM_PROVISIONING_KEY !== 'string')
|
|
@@ -201,7 +201,7 @@ const buildJob = async (options: CloudflareControlOptions, input: ProviderDeploy
|
|
|
201
201
|
credentials: {
|
|
202
202
|
CLOUDFLARE_ACCOUNT_ID: options.accountId,
|
|
203
203
|
CLOUDFLARE_API_TOKEN: options.apiToken,
|
|
204
|
-
...(options.propustkaUrl === undefined ? {} : {
|
|
204
|
+
...(options.propustkaUrl === undefined ? {} : { FABRIKA_IAM_ISSUER: options.propustkaUrl }),
|
|
205
205
|
...(options.propustkaProvisioningKey === undefined
|
|
206
206
|
? {}
|
|
207
207
|
: { FABRIKA_IAM_PROVISIONING_KEY: options.propustkaProvisioningKey }),
|
package/src/proxy-worker.ts
CHANGED
|
@@ -33,7 +33,7 @@ const CLOUDFLARE_CLIENT_ADDRESS_HEADER = 'CF-Connecting-IP'
|
|
|
33
33
|
export interface CloudflareProxyEnv {
|
|
34
34
|
readonly IAM?: unknown
|
|
35
35
|
readonly FABRIKA_PROXY_MANIFEST_JSON?: string
|
|
36
|
-
readonly
|
|
36
|
+
readonly FABRIKA_IAM_ISSUER?: string
|
|
37
37
|
readonly [binding: string]: unknown
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -75,7 +75,7 @@ function canonicalIssuer(raw: string | undefined): string | null {
|
|
|
75
75
|
/** Factory exported for Lopata and unit tests; production uses the default Worker fetch below. */
|
|
76
76
|
export function createCloudflareProxyHandler(env: CloudflareProxyEnv, logger: ProxyLogger = consoleLogger): ProxyFetch {
|
|
77
77
|
const manifestJson = env.FABRIKA_PROXY_MANIFEST_JSON ?? ''
|
|
78
|
-
const canonical = canonicalIssuer(env.
|
|
78
|
+
const canonical = canonicalIssuer(env.FABRIKA_IAM_ISSUER)
|
|
79
79
|
if (!isIamGateway(env.IAM) || manifestJson === '' || canonical === null) return () => Promise.resolve(UNAVAILABLE.clone())
|
|
80
80
|
const issuer = canonical
|
|
81
81
|
|
package/src/proxy.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function createCloudflareProxyWorker(options: CloudflareProxyWorkerOption
|
|
|
60
60
|
observability: { logs: { enabled: true, invocation_logs: false } },
|
|
61
61
|
vars: {
|
|
62
62
|
FABRIKA_PROXY_MANIFEST_JSON: encodeProxyManifestJson(manifest),
|
|
63
|
-
|
|
63
|
+
FABRIKA_IAM_ISSUER: options.iamUrl ?? '',
|
|
64
64
|
},
|
|
65
65
|
bindings: {
|
|
66
66
|
IAM: new ServiceReference(options.iamService ?? 'propustka-worker'),
|