Skip to content

Commit 3be8a22

Browse files
committed
fix databricks env var names
1 parent 307e801 commit 3be8a22

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

packages/cubejs-backend-shared/src/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ const variables: Record<string, (...args: any) => any> = {
954954
/**
955955
* Databricks jdbc-connection url.
956956
*/
957-
databrickUrl: ({
957+
databricksUrl: ({
958958
dataSource,
959959
}: {
960960
dataSource: string,
@@ -975,7 +975,7 @@ const variables: Record<string, (...args: any) => any> = {
975975
/**
976976
* Databricks jdbc-connection token.
977977
*/
978-
databrickToken: ({
978+
databricksToken: ({
979979
dataSource,
980980
}: {
981981
dataSource: string,

packages/cubejs-backend-shared/test/db_env_multi.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,31 +1105,31 @@ describe('Multiple datasources', () => {
11051105
process.env.CUBEJS_DB_DATABRICKS_URL = 'default1';
11061106
process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_URL = 'postgres1';
11071107
process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_URL = 'wrong1';
1108-
expect(getEnv('databrickUrl', { dataSource: 'default' })).toEqual('default1');
1109-
expect(getEnv('databrickUrl', { dataSource: 'postgres' })).toEqual('postgres1');
1110-
expect(() => getEnv('databrickUrl', { dataSource: 'wrong' })).toThrow(
1108+
expect(getEnv('databricksUrl', { dataSource: 'default' })).toEqual('default1');
1109+
expect(getEnv('databricksUrl', { dataSource: 'postgres' })).toEqual('postgres1');
1110+
expect(() => getEnv('databricksUrl', { dataSource: 'wrong' })).toThrow(
11111111
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11121112
);
11131113

11141114
process.env.CUBEJS_DB_DATABRICKS_URL = 'default2';
11151115
process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_URL = 'postgres2';
11161116
process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_URL = 'wrong2';
1117-
expect(getEnv('databrickUrl', { dataSource: 'default' })).toEqual('default2');
1118-
expect(getEnv('databrickUrl', { dataSource: 'postgres' })).toEqual('postgres2');
1119-
expect(() => getEnv('databrickUrl', { dataSource: 'wrong' })).toThrow(
1117+
expect(getEnv('databricksUrl', { dataSource: 'default' })).toEqual('default2');
1118+
expect(getEnv('databricksUrl', { dataSource: 'postgres' })).toEqual('postgres2');
1119+
expect(() => getEnv('databricksUrl', { dataSource: 'wrong' })).toThrow(
11201120
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11211121
);
11221122

11231123
delete process.env.CUBEJS_DB_DATABRICKS_URL;
11241124
delete process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_URL;
11251125
delete process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_URL;
1126-
expect(() => getEnv('databrickUrl', { dataSource: 'default' })).toThrow(
1126+
expect(() => getEnv('databricksUrl', { dataSource: 'default' })).toThrow(
11271127
'The CUBEJS_DB_DATABRICKS_URL is required and missing.'
11281128
);
1129-
expect(() => getEnv('databrickUrl', { dataSource: 'postgres' })).toThrow(
1129+
expect(() => getEnv('databricksUrl', { dataSource: 'postgres' })).toThrow(
11301130
'The CUBEJS_DS_POSTGRES_DB_DATABRICKS_URL is required and missing.'
11311131
);
1132-
expect(() => getEnv('databrickUrl', { dataSource: 'wrong' })).toThrow(
1132+
expect(() => getEnv('databricksUrl', { dataSource: 'wrong' })).toThrow(
11331133
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11341134
);
11351135
});
@@ -1138,27 +1138,27 @@ describe('Multiple datasources', () => {
11381138
process.env.CUBEJS_DB_DATABRICKS_TOKEN = 'default1';
11391139
process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_TOKEN = 'postgres1';
11401140
process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_TOKEN = 'wrong1';
1141-
expect(getEnv('databrickToken', { dataSource: 'default' })).toEqual('default1');
1142-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toEqual('postgres1');
1143-
expect(() => getEnv('databrickToken', { dataSource: 'wrong' })).toThrow(
1141+
expect(getEnv('databricksToken', { dataSource: 'default' })).toEqual('default1');
1142+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toEqual('postgres1');
1143+
expect(() => getEnv('databricksToken', { dataSource: 'wrong' })).toThrow(
11441144
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11451145
);
11461146

11471147
process.env.CUBEJS_DB_DATABRICKS_TOKEN = 'default2';
11481148
process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_TOKEN = 'postgres2';
11491149
process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_TOKEN = 'wrong2';
1150-
expect(getEnv('databrickToken', { dataSource: 'default' })).toEqual('default2');
1151-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toEqual('postgres2');
1152-
expect(() => getEnv('databrickToken', { dataSource: 'wrong' })).toThrow(
1150+
expect(getEnv('databricksToken', { dataSource: 'default' })).toEqual('default2');
1151+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toEqual('postgres2');
1152+
expect(() => getEnv('databricksToken', { dataSource: 'wrong' })).toThrow(
11531153
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11541154
);
11551155

11561156
delete process.env.CUBEJS_DB_DATABRICKS_TOKEN;
11571157
delete process.env.CUBEJS_DS_POSTGRES_DB_DATABRICKS_TOKEN;
11581158
delete process.env.CUBEJS_DS_WRONG_DB_DATABRICKS_TOKEN;
1159-
expect(getEnv('databrickToken', { dataSource: 'default' })).toBeUndefined();
1160-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toBeUndefined();
1161-
expect(() => getEnv('databrickToken', { dataSource: 'wrong' })).toThrow(
1159+
expect(getEnv('databricksToken', { dataSource: 'default' })).toBeUndefined();
1160+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toBeUndefined();
1161+
expect(() => getEnv('databricksToken', { dataSource: 'wrong' })).toThrow(
11621162
'The wrong data source is missing in the declared CUBEJS_DATASOURCES.'
11631163
);
11641164
});

packages/cubejs-backend-shared/test/db_env_single.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -705,42 +705,42 @@ describe('Single datasources', () => {
705705

706706
test('getEnv("databrickUrl")', () => {
707707
process.env.CUBEJS_DB_DATABRICKS_URL = 'default1';
708-
expect(getEnv('databrickUrl', { dataSource: 'default' })).toEqual('default1');
709-
expect(getEnv('databrickUrl', { dataSource: 'postgres' })).toEqual('default1');
710-
expect(getEnv('databrickUrl', { dataSource: 'wrong' })).toEqual('default1');
708+
expect(getEnv('databricksUrl', { dataSource: 'default' })).toEqual('default1');
709+
expect(getEnv('databricksUrl', { dataSource: 'postgres' })).toEqual('default1');
710+
expect(getEnv('databricksUrl', { dataSource: 'wrong' })).toEqual('default1');
711711

712712
process.env.CUBEJS_DB_DATABRICKS_URL = 'default2';
713-
expect(getEnv('databrickUrl', { dataSource: 'default' })).toEqual('default2');
714-
expect(getEnv('databrickUrl', { dataSource: 'postgres' })).toEqual('default2');
715-
expect(getEnv('databrickUrl', { dataSource: 'wrong' })).toEqual('default2');
713+
expect(getEnv('databricksUrl', { dataSource: 'default' })).toEqual('default2');
714+
expect(getEnv('databricksUrl', { dataSource: 'postgres' })).toEqual('default2');
715+
expect(getEnv('databricksUrl', { dataSource: 'wrong' })).toEqual('default2');
716716

717717
delete process.env.CUBEJS_DB_DATABRICKS_URL;
718-
expect(() => getEnv('databrickUrl', { dataSource: 'default' })).toThrow(
718+
expect(() => getEnv('databricksUrl', { dataSource: 'default' })).toThrow(
719719
'The CUBEJS_DB_DATABRICKS_URL is required and missing.'
720720
);
721-
expect(() => getEnv('databrickUrl', { dataSource: 'postgres' })).toThrow(
721+
expect(() => getEnv('databricksUrl', { dataSource: 'postgres' })).toThrow(
722722
'The CUBEJS_DB_DATABRICKS_URL is required and missing.'
723723
);
724-
expect(() => getEnv('databrickUrl', { dataSource: 'wrong' })).toThrow(
724+
expect(() => getEnv('databricksUrl', { dataSource: 'wrong' })).toThrow(
725725
'The CUBEJS_DB_DATABRICKS_URL is required and missing.'
726726
);
727727
});
728728

729729
test('getEnv("databrickToken")', () => {
730730
process.env.CUBEJS_DB_DATABRICKS_TOKEN = 'default1';
731-
expect(getEnv('databrickToken', { dataSource: 'default' })).toEqual('default1');
732-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toEqual('default1');
733-
expect(getEnv('databrickToken', { dataSource: 'wrong' })).toEqual('default1');
731+
expect(getEnv('databricksToken', { dataSource: 'default' })).toEqual('default1');
732+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toEqual('default1');
733+
expect(getEnv('databricksToken', { dataSource: 'wrong' })).toEqual('default1');
734734

735735
process.env.CUBEJS_DB_DATABRICKS_TOKEN = 'default2';
736-
expect(getEnv('databrickToken', { dataSource: 'default' })).toEqual('default2');
737-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toEqual('default2');
738-
expect(getEnv('databrickToken', { dataSource: 'wrong' })).toEqual('default2');
736+
expect(getEnv('databricksToken', { dataSource: 'default' })).toEqual('default2');
737+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toEqual('default2');
738+
expect(getEnv('databricksToken', { dataSource: 'wrong' })).toEqual('default2');
739739

740740
delete process.env.CUBEJS_DB_DATABRICKS_TOKEN;
741-
expect(getEnv('databrickToken', { dataSource: 'default' })).toBeUndefined();
742-
expect(getEnv('databrickToken', { dataSource: 'postgres' })).toBeUndefined();
743-
expect(getEnv('databrickToken', { dataSource: 'wrong' })).toBeUndefined();
741+
expect(getEnv('databricksToken', { dataSource: 'default' })).toBeUndefined();
742+
expect(getEnv('databricksToken', { dataSource: 'postgres' })).toBeUndefined();
743+
expect(getEnv('databricksToken', { dataSource: 'wrong' })).toBeUndefined();
744744
});
745745

746746
test('getEnv("databricksCatalog")', () => {

packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class DatabricksDriver extends JDBCDriver {
192192
let showSparkProtocolWarn = false;
193193
let url: string =
194194
conf?.url ||
195-
getEnv('databrickUrl', { dataSource }) ||
195+
getEnv('databricksUrl', { dataSource }) ||
196196
getEnv('jdbcUrl', { dataSource });
197197
if (url.indexOf('jdbc:spark://') !== -1) {
198198
showSparkProtocolWarn = true;
@@ -211,7 +211,7 @@ export class DatabricksDriver extends JDBCDriver {
211211
UID: uid,
212212
PWD:
213213
conf?.token ||
214-
getEnv('databrickToken', { dataSource }) ||
214+
getEnv('databricksToken', { dataSource }) ||
215215
pwd,
216216
UserAgentEntry: 'CubeDev_Cube',
217217
},

0 commit comments

Comments
 (0)