Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (flags.endpoint) {
config.setDefaults({
service: {
endpoint: {
url: flags.endpoint,
headers: headersArrayToObject(flags.header),
...(flags.skipSSLValidation && { skipSSLValidation: true })
}
}
});
}
// this can set a single or multiple local schema files
if (flags.localSchemaFile) {
const files = flags.localSchemaFile.split(",");
if (isClientConfig(config)) {
config.setDefaults({
client: {
service: {
localSchemaFile: files
}
}
});
} else if (isServiceConfig(config)) {
config.setDefaults({
service: {
localSchemaFile: files
}
});
}
}
if (flags.endpoint) {
config.setDefaults({
service: {
endpoint: {
url: flags.endpoint,
headers: headersArrayToObject(flags.header),
...(flags.skipSSLValidation && { skipSSLValidation: true })
}
}
});
}
// this can set a single or multiple local schema files
if (flags.localSchemaFile) {
const files = flags.localSchemaFile.split(",");
if (isClientConfig(config)) {
config.setDefaults({
client: {
service: {
localSchemaFile: files
}
}
});
} else if (isServiceConfig(config)) {
config.setDefaults({
service: {
localSchemaFile: files
}
});
}
}
: URI.file(parse(configPath).dir);
const clientIdentity = {
name: "Apollo CLI",
version,
referenceID
};
if (isServiceConfig(config)) {
this.project = new GraphQLServiceProject({
config,
loadingHandler,
rootURI,
clientIdentity
});
} else if (isClientConfig(config)) {
this.project = new GraphQLClientProject({
config,
loadingHandler,
rootURI,
clientIdentity
});
} else {
throw new Error(
"Unable to resolve project type. Please add either a client or service config. For more information, please refer to https://bit.ly/2ByILPj"
);
}
this.ctx.project = this.project;
}