Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async createConfig(flags: Flags) {
const service = flags.key ? getServiceFromKey(flags.key) : undefined;
const config = await loadConfig({
configPath: flags.config && parse(resolve(flags.config)).dir,
configFileName: flags.config,
name: service,
type: this.type
});
if (!config) {
this.error("A config failed to load, so the command couldn't be run");
this.exit(1);
return;
}
config.tag = flags.tag || config.tag || "current";
// flag overrides
config.setDefaults({
useEffect(() => {
const oclif = this.parse(ApolloCommand);
const service = oclif.flags.key
? getServiceFromKey(oclif.flags.key)
: undefined;
this.loadConfigFromFlags(oclif.flags, service)
.then(config => {
if (!config) throw new Error("Could not load config");
const client = new ApolloClient({
name: "Apollo CLI",
version,
link: new HttpLink({
uri: config.engine.endpoint,
headers: {
"x-api-key": config.engine.apiKey || service,
"apollo-client-reference-id": referenceID
},
fetch: fetch as any
}),
cache: new InMemoryCache()