Closed adgai closed 5 months ago
To simultaneously fetch and display configuration values for a specific key across multiple environments, you can develop a plugin by following these steps:
Integrate with Apollo: Use Apollo client APIs to fetch configuration data for the desired key across the environments you're interested in. This involves making API calls similar to ConfigService.find_items()
for each environment.
Develop the User Interface: Create a UI where users can select a configuration key and multiple environments. You can take inspiration from the diff.html
file, utilizing elements like the cluster selector and display format options.
Fetch and Display Configurations: Implement functionality to fetch the configuration values upon form submission and display them in a user-friendly format. Adapt the table structure from diff.html
for displaying the values across environments.
Code Example for Fetching Configurations:
function fetchConfigForKey(appId, envs, clusterName, namespaceName, key) {
let promises = envs.map(env =>
ConfigService.find_items(appId, env, clusterName, namespaceName)
.then(items => items.find(item => item.key === key))
);
return Promise.all(promises);
}
Optimize User Experience: Include features like filtering, sorting, a refresh button, and possibly a search functionality to enhance the plugin's usability.
Ensure your plugin has comprehensive error handling, considers performance optimization through caching, and enforces security measures to protect sensitive configurations. This approach builds on the functionality seen in the Apollo portal's DiffConfigController.js
and diff.html
, extending it to focus on your specific requirement of displaying configuration keys across multiple environments.
To continue the conversation, mention @dosu.
open api 如果获取一个没配的key 会404,在获取生产环境的key的值时不太合适
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.
清晰简洁地描述这个问题是什么。即,当碰到xxx时,总是感觉很麻烦
我们目前项目中获取配置是使用 configService.get(key),这样的形式,需要看到key 对应的value 只能到 portal 中看,我想开发一个插件展示各个环境的值,所以想同时获取到多个环境的值。