mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 22:47:17 +00:00
23 lines
519 B
TypeScript
23 lines
519 B
TypeScript
import { readFileSync } from 'fs';
|
|
import * as yaml from 'js-yaml';
|
|
|
|
let loadedConfig: any = null;
|
|
|
|
export function getLocalComposeConfig() {
|
|
if (!loadedConfig) {
|
|
loadedConfig = yaml.load(readFileSync('../docker-compose.community.yml', 'utf8'));
|
|
}
|
|
|
|
return {
|
|
config: loadedConfig,
|
|
service(name: string) {
|
|
const service = loadedConfig.services[name];
|
|
|
|
if (!service) {
|
|
throw new Error(`Service ${name} not found in Docker compose file!`);
|
|
}
|
|
|
|
return service;
|
|
},
|
|
};
|
|
}
|