Merge branch 'master' into csp-whitelist

This commit is contained in:
Andrew Kingston 2025-04-09 10:54:29 +01:00 committed by GitHub
commit 11a42ca08b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 34 additions and 12 deletions

View File

@ -17,6 +17,7 @@ COPY error.html /usr/share/nginx/html/error.html
# Default environment # Default environment
ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10 ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10
ENV PROXY_RATE_LIMIT_API_PER_SECOND=20 ENV PROXY_RATE_LIMIT_API_PER_SECOND=20
ENV PROXY_TIMEOUT_SECONDS=120
# Use docker-compose values as defaults for backwards compatibility # Use docker-compose values as defaults for backwards compatibility
ENV APPS_UPSTREAM_URL=http://app-service:4002 ENV APPS_UPSTREAM_URL=http://app-service:4002
ENV WORKER_UPSTREAM_URL=http://worker-service:4003 ENV WORKER_UPSTREAM_URL=http://worker-service:4003

View File

@ -144,9 +144,9 @@ http {
limit_req zone=ratelimit burst=20 nodelay; limit_req zone=ratelimit burst=20 nodelay;
# 120s timeout on API requests # 120s timeout on API requests
proxy_read_timeout 120s; proxy_read_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_connect_timeout 120s; proxy_connect_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_send_timeout 120s; proxy_send_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
@ -164,9 +164,9 @@ http {
# Rest of configuration copied from /api/ location above # Rest of configuration copied from /api/ location above
# 120s timeout on API requests # 120s timeout on API requests
proxy_read_timeout 120s; proxy_read_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_connect_timeout 120s; proxy_connect_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_send_timeout 120s; proxy_send_timeout ${PROXY_TIMEOUT_SECONDS}s;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;

View File

@ -10,7 +10,14 @@ import {
StaticDatabases, StaticDatabases,
DEFAULT_TENANT_ID, DEFAULT_TENANT_ID,
} from "../constants" } from "../constants"
import { Database, IdentityContext, Snippet, App, Table } from "@budibase/types" import {
Database,
IdentityContext,
Snippet,
App,
Table,
License,
} from "@budibase/types"
import { ContextMap } from "./types" import { ContextMap } from "./types"
let TEST_APP_ID: string | null = null let TEST_APP_ID: string | null = null
@ -171,6 +178,18 @@ export async function doInSelfHostTenantUsingCloud<T>(
return newContext(updates, task) return newContext(updates, task)
} }
export async function doInLicenseContext<T>(
license: License,
task: () => T
): Promise<T> {
return newContext({ license }, task)
}
export function getLicense(): License | undefined {
const context = Context.get()
return context?.license
}
export function isSelfHostUsingCloud() { export function isSelfHostUsingCloud() {
const context = Context.get() const context = Context.get()
return !!context?.isSelfHostUsingCloud return !!context?.isSelfHostUsingCloud

View File

@ -1,4 +1,4 @@
import { IdentityContext, Snippet, Table, VM } from "@budibase/types" import { IdentityContext, License, Snippet, Table, VM } from "@budibase/types"
import { OAuth2Client } from "google-auth-library" import { OAuth2Client } from "google-auth-library"
import { GoogleSpreadsheet } from "google-spreadsheet" import { GoogleSpreadsheet } from "google-spreadsheet"
@ -6,6 +6,7 @@ import { GoogleSpreadsheet } from "google-spreadsheet"
export type ContextMap = { export type ContextMap = {
tenantId?: string tenantId?: string
isSelfHostUsingCloud?: boolean isSelfHostUsingCloud?: boolean
license?: License
appId?: string appId?: string
identity?: IdentityContext identity?: IdentityContext
environmentVariables?: Record<string, string> environmentVariables?: Record<string, string>

View File

@ -38,7 +38,7 @@
}, },
}, },
[FIELDS.OPTIONS.type]: { [FIELDS.OPTIONS.type]: {
label: "Options", label: "Single select",
value: FIELDS.OPTIONS.type, value: FIELDS.OPTIONS.type,
config: { config: {
type: FIELDS.OPTIONS.type, type: FIELDS.OPTIONS.type,
@ -46,7 +46,7 @@
}, },
}, },
[FIELDS.ARRAY.type]: { [FIELDS.ARRAY.type]: {
label: "Multi-select", label: "Multi select",
value: FIELDS.ARRAY.type, value: FIELDS.ARRAY.type,
config: { config: {
type: FIELDS.ARRAY.type, type: FIELDS.ARRAY.type,

@ -1 +1 @@
Subproject commit 305c909a9f6ca88281c1213a4f4088c9f00dbc2c Subproject commit dcf65b2361ae31aab0ccfadd8222d3aa3c421181

View File

@ -5,6 +5,7 @@ import { configs, env, features, setEnv } from "@budibase/backend-core"
import { import {
AIInnerConfig, AIInnerConfig,
ConfigType, ConfigType,
Feature,
License, License,
PlanModel, PlanModel,
PlanType, PlanType,
@ -291,7 +292,7 @@ describe("BudibaseAI", () => {
model: PlanModel.PER_USER, model: PlanModel.PER_USER,
usesInvoicing: false, usesInvoicing: false,
}, },
features: [], features: [Feature.BUDIBASE_AI],
quotas: {} as any, quotas: {} as any,
tenantId: config.tenantId, tenantId: config.tenantId,
} }