cube.js 配置json schema

通过对与cube 配置的json schema 学习我们可以知道cube.js 都包含了那些扩展点,可以方便系统的扩容以及优化

内容

const schemaOptions = Joi.object().keys({
  // server CreateOptions
  initApp: Joi.func(),
  webSockets: Joi.boolean(),
  http: Joi.object().keys({
    cors: Joi.object(),
  }),
  gracefulShutdown: Joi.number().min(0).integer(),
  // Additional from WebSocketServerOptions
  processSubscriptionsInterval: Joi.number(),
  webSocketsBasePath: Joi.string(),
  // server-core CoreCreateOptions
  dbType: dbTypes,
  externalDbType: dbTypes,
  schemaPath: Joi.string(),
  basePath: Joi.string(),
  devServer: Joi.boolean(),
  apiSecret: Joi.string(),
  logger: Joi.func(),
  // source
  dialectFactory: Joi.func(),
  driverFactory: Joi.func(),
  // external
  externalDialectFactory: Joi.func(),
  externalDriverFactory: Joi.func(),
  //
  cacheAndQueueDriver: Joi.string().valid('redis', 'memory'),
  contextToAppId: Joi.func(),
  contextToOrchestratorId: Joi.func(),
  contextToDataSourceId: Joi.func(),
  repositoryFactory: Joi.func(),
  checkAuth: Joi.func(),
  checkAuthMiddleware: Joi.func(),
  jwt: jwtOptions,
  queryTransformer: Joi.func(),
  queryRewrite: Joi.func(),
  preAggregationsSchema: Joi.alternatives().try(
    Joi.string(),
    Joi.func()
  ),
  schemaVersion: Joi.func(),
  extendContext: Joi.func(),
  // Scheduled refresh
  scheduledRefreshTimer: Joi.alternatives().try(
    Joi.boolean(),
    Joi.number().min(0).integer()
  ),
  scheduledRefreshTimeZones: Joi.array().items(Joi.string()),
  scheduledRefreshContexts: Joi.func(),
  scheduledRefreshConcurrency: Joi.number().min(1).integer(),
  // Compiler cache
  compilerCacheSize: Joi.number().min(0).integer(),
  updateCompilerCacheKeepAlive: Joi.boolean(),
  maxCompilerCacheKeepAlive: Joi.number().min(0).integer(),
  telemetry: Joi.boolean(),
  allowUngroupedWithoutPrimaryKey: Joi.boolean(),
  orchestratorOptions: Joi.alternatives().try(
    Joi.func(),
    Joi.object().keys({
      redisPrefix: Joi.string().allow(''),
      redisPoolOptions: Joi.object().keys({
        poolMin: Joi.number().min(0),
        poolMax: Joi.number().min(0),
        idleTimeoutSeconds: Joi.number().min(0),
        softIdleTimeoutSeconds: Joi.number().min(0),
        createClient: Joi.func(),
        destroyClient: Joi.func(),
        poolOptions: Joi.object().keys({
          maxWaitingClients: Joi.number(),
          testOnBorrow: Joi.bool(),
          testOnReturn: Joi.bool(),
          acquireTimeoutMillis: Joi.number(),
          fifo: Joi.bool(),
          priorityRange: Joi.number(),
          autostart: Joi.bool(),
          evictionRunIntervalMillis: Joi.number().min(0),
          numTestsPerEvictionRun: Joi.number().min(1),
          softIdleTimeoutMillis: Joi.number().min(0),
          idleTimeoutMillis: Joi.number().min(0),
        })
      }),
      continueWaitTimeout: Joi.number().min(0).integer(),
      skipExternalCacheAndQueue: Joi.boolean(),
      queryCacheOptions: Joi.object().keys({
        refreshKeyRenewalThreshold: Joi.number().min(0).integer(),
        backgroundRenew: Joi.boolean(),
        queueOptions: schemaQueueOptions,
        externalQueueOptions: schemaQueueOptions
      }),
      preAggregationsOptions: {
        queueOptions: schemaQueueOptions,
        externalRefresh: Joi.boolean(),
      },
      rollupOnlyMode: Joi.boolean()
    })
  ),
  allowJsDuplicatePropsInSchema: Joi.boolean(),
  dashboardAppPath: Joi.string(),
  dashboardAppPort: Joi.number(),
  sqlCache: Joi.boolean(),
  livePreview: Joi.boolean(),
  // SQL API
  sqlPort: Joi.number(),
  pgSqlPort: Joi.number(),
  checkSqlAuth: Joi.func(),
  sqlUser: Joi.string(),
  sqlPassword: Joi.string(),
  // Additional system flags
  serverless: Joi.boolean(),
  allowNodeRequire: Joi.boolean(),
});

参考资料

https://github.com/cube-js/cube.js/blob/36b65ef40415a3fdf6cbbcc0a6d1a6b345add1c5/packages/cubejs-server-core/src/core/optionsValidate.ts

posted on   荣锋亮  阅读(90)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2021-06-11 jcasbin redis watcher 一些修改
2021-06-11 cube.js 0.27.31 一些新特性
2020-06-11 pgspider clickhouse fdw v2 版本
2020-06-11 ola 不错的sql server 维护方案
2020-06-11 几个不错的web资源inlines npm包
2020-06-11 nodejs 几个不错的callback 以及promise 转换处理工具
2019-06-11 circus security 来自官方的安全建议

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 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 1 2 3 4 5
点击右上角即可分享
微信分享提示