MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / loadAwsConfig

Function loadAwsConfig

lib/aws.ts:95–113  ·  view source on GitHub ↗
(properties: PropertyGetter)

Source from the content-addressed store, hash-verified

93let awsProps: PropertyGetter | null = null;
94
95async function loadAwsConfig(properties: PropertyGetter) {
96 const region = properties<string>('region');
97 if (!region) return {};
98 await initialiseAwsCredentials(region);
99 const ssm = new SSM({region: region, credentials: awsCredentials()});
100 const path = '/compiler-explorer/';
101 try {
102 const response = await ssm.getParameters({Names: [path + 'sentryDsn']});
103 const map: Record<string, string | undefined> = {};
104 for (const param of unwrap(response.Parameters)) {
105 map[unwrap(param.Name).substring(path.length)] = param.Value;
106 }
107 logger.info('AWS info:', map);
108 return map;
109 } catch (err) {
110 logger.error(`Failed to get AWS info: ${err}`);
111 return {};
112 }
113}
114
115export async function initConfig(properties: PropertyGetter) {
116 awsConfigInit = true;

Callers 1

initConfigFunction · 0.85

Calls 4

initialiseAwsCredentialsFunction · 0.85
awsCredentialsFunction · 0.85
errorMethod · 0.80
unwrapFunction · 0.70

Tested by

no test coverage detected