diff --git a/packages/cubejs-api-gateway/src/sql-server.ts b/packages/cubejs-api-gateway/src/sql-server.ts index 9c761e7ab2ade..5ab0318b29f55 100644 --- a/packages/cubejs-api-gateway/src/sql-server.ts +++ b/packages/cubejs-api-gateway/src/sql-server.ts @@ -62,13 +62,17 @@ export class SQLServer { await execSql(this.sqlInterfaceInstance!, sqlQuery, stream, securityContext); } + protected buildCheckSqlAuth(options: SQLServerOptions): CheckSQLAuthFn { + return (options.checkSqlAuth && this.wrapCheckSqlAuthFn(options.checkSqlAuth)) + || this.createDefaultCheckSqlAuthFn(options); + } + public async init(options: SQLServerOptions): Promise { if (this.sqlInterfaceInstance) { throw new Error('Unable to start SQL interface two times'); } - const checkSqlAuth: CheckSQLAuthFn = (options.checkSqlAuth && this.wrapCheckSqlAuthFn(options.checkSqlAuth)) - || this.createDefaultCheckSqlAuthFn(options); + const checkSqlAuth: CheckSQLAuthFn = this.buildCheckSqlAuth(options); const canSwitchSqlUser: CanSwitchSQLUserFn = options.canSwitchSqlUser || this.createDefaultCanSwitchSqlUserFn(options);