Skip to content

Commit

Permalink
update dynamic API calls to pass correct input
Browse files Browse the repository at this point in the history
Signed-off-by: Tianle Huang <[email protected]>
  • Loading branch information
tianleh committed Apr 16, 2024
1 parent eef417c commit 17f78b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
# opensearchDashboards.configIndex: ".opensearch_dashboards_config"

# Set the value of this setting to true to enable plugin application config. By default it is disabled.
# application_config.enabled: false
application_config.enabled: true

# Set the value of this setting to true to enable plugin CSP handler. By default it is disabled.
# It requires the application config plugin as its dependency.
# csp_handler.enabled: false
csp_handler.enabled: true

# The default application to load.
#opensearchDashboards.defaultAppId: "home"
Expand Down
12 changes: 5 additions & 7 deletions src/plugins/application_config/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { schema } from '@osd/config-schema';
import {
IRouter,
IScopedClusterClient,
Logger,
OpenSearchDashboardsRequest,
OpenSearchDashboardsResponseFactory,
Expand All @@ -15,7 +14,7 @@ import { ConfigurationClient } from '../types';

export function defineRoutes(
router: IRouter,
getConfigurationClient: (configurationClient: IScopedClusterClient) => ConfigurationClient,
getConfigurationClient: (request?: OpenSearchDashboardsRequest) => ConfigurationClient,
logger: Logger
) {
router.get(
Expand All @@ -24,8 +23,7 @@ export function defineRoutes(
validate: false,
},
async (context, request, response) => {
const client = getConfigurationClient(context.core.opensearch.client);

const client = getConfigurationClient(request);

Check warning on line 26 in src/plugins/application_config/server/routes/index.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/application_config/server/routes/index.ts#L26

Added line #L26 was not covered by tests
return await handleGetConfig(client, request, response, logger);
}
);
Expand All @@ -39,7 +37,7 @@ export function defineRoutes(
},
},
async (context, request, response) => {
const client = getConfigurationClient(context.core.opensearch.client);
const client = getConfigurationClient(request);

Check warning on line 40 in src/plugins/application_config/server/routes/index.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/application_config/server/routes/index.ts#L40

Added line #L40 was not covered by tests

return await handleGetEntityConfig(client, request, response, logger);
}
Expand All @@ -57,7 +55,7 @@ export function defineRoutes(
},
},
async (context, request, response) => {
const client = getConfigurationClient(context.core.opensearch.client);
const client = getConfigurationClient(request);

Check warning on line 58 in src/plugins/application_config/server/routes/index.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/application_config/server/routes/index.ts#L58

Added line #L58 was not covered by tests

return await handleUpdateEntityConfig(client, request, response, logger);
}
Expand All @@ -72,7 +70,7 @@ export function defineRoutes(
},
},
async (context, request, response) => {
const client = getConfigurationClient(context.core.opensearch.client);
const client = getConfigurationClient(request);

Check warning on line 73 in src/plugins/application_config/server/routes/index.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/application_config/server/routes/index.ts#L73

Added line #L73 was not covered by tests

return await handleDeleteEntityConfig(client, request, response, logger);
}
Expand Down

0 comments on commit 17f78b2

Please sign in to comment.