Activate CassandraProxy in MPAC
This commit is contained in:
parent
5042f28229
commit
d720be1250
|
@ -102,20 +102,20 @@ let configContext: Readonly<ConfigContext> = {
|
||||||
NEW_BACKEND_APIS: [BackendApi.GenerateToken],
|
NEW_BACKEND_APIS: [BackendApi.GenerateToken],
|
||||||
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
||||||
NEW_MONGO_APIS: [
|
NEW_MONGO_APIS: [
|
||||||
// "resourcelist",
|
"resourcelist",
|
||||||
// "createDocument",
|
"createDocument",
|
||||||
// "readDocument",
|
"readDocument",
|
||||||
// "updateDocument",
|
"updateDocument",
|
||||||
// "deleteDocument",
|
"deleteDocument",
|
||||||
// "createCollectionWithProxy",
|
"createCollectionWithProxy",
|
||||||
],
|
],
|
||||||
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
||||||
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
||||||
NEW_CASSANDRA_APIS: [
|
NEW_CASSANDRA_APIS: [
|
||||||
// "postQuery",
|
"postQuery",
|
||||||
// "createOrDelete",
|
"createOrDelete",
|
||||||
// "getKeys",
|
"getKeys",
|
||||||
// "getSchema",
|
"getSchema",
|
||||||
],
|
],
|
||||||
CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
||||||
isTerminalEnabled: false,
|
isTerminalEnabled: false,
|
||||||
|
@ -248,3 +248,4 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export { configContext };
|
export { configContext };
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import Explorer from "../Explorer";
|
||||||
import * as TableConstants from "./Constants";
|
import * as TableConstants from "./Constants";
|
||||||
import * as Entities from "./Entities";
|
import * as Entities from "./Entities";
|
||||||
import * as TableEntityProcessor from "./TableEntityProcessor";
|
import * as TableEntityProcessor from "./TableEntityProcessor";
|
||||||
import { CassandraProxyAPIs } from "../../Common/Constants";
|
import { CassandraProxyAPIs, CassandraProxyEndpoints } from "../../Common/Constants";
|
||||||
|
|
||||||
export interface CassandraTableKeys {
|
export interface CassandraTableKeys {
|
||||||
partitionKeys: CassandraTableKey[];
|
partitionKeys: CassandraTableKey[];
|
||||||
|
@ -458,7 +458,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTableKeys(collection: ViewModels.Collection): Q.Promise<CassandraTableKeys> {
|
public getTableKeys(collection: ViewModels.Collection): Q.Promise<CassandraTableKeys> {
|
||||||
if (!this.useCassandraProxyEndpoint("getTableKeys")) {
|
if (!this.useCassandraProxyEndpoint("getKeys")) {
|
||||||
return this.getTableKeys_ToBeDeprecated(collection);
|
return this.getTableKeys_ToBeDeprecated(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,6 +732,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private useCassandraProxyEndpoint(api: string): boolean {
|
private useCassandraProxyEndpoint(api: string): boolean {
|
||||||
|
const activeCassandraProxyEndpoints: string[] = [CassandraProxyEndpoints.Development, CassandraProxyEndpoints.Mpac];
|
||||||
let canAccessCassandraProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled";
|
let canAccessCassandraProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled";
|
||||||
if (userContext.databaseAccount.properties.ipRules?.length > 0) {
|
if (userContext.databaseAccount.properties.ipRules?.length > 0) {
|
||||||
canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED;
|
canAccessCassandraProxy = canAccessCassandraProxy && configContext.CASSANDRA_PROXY_OUTBOUND_IPS_ALLOWLISTED;
|
||||||
|
@ -740,9 +741,7 @@ export class CassandraAPIDataClient extends TableDataClient {
|
||||||
return (
|
return (
|
||||||
canAccessCassandraProxy &&
|
canAccessCassandraProxy &&
|
||||||
configContext.NEW_CASSANDRA_APIS?.includes(api) &&
|
configContext.NEW_CASSANDRA_APIS?.includes(api) &&
|
||||||
[Constants.CassandraProxyEndpoints.Development, Constants.CassandraProxyEndpoints.Mpac].includes(
|
activeCassandraProxyEndpoints.includes(configContext.CASSANDRA_PROXY_ENDPOINT)
|
||||||
configContext.CASSANDRA_PROXY_ENDPOINT,
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue