# Configuration file

# .sgtsrc.js

Simple-graphql-to-typescript can also be used with a configuration file .sgtsrc.js at the root of your app instead of CLI options

TIP

Running sgts init will help you generate a .sgtsrc.js file for you

TIP

For the detail of each options, refer to the options page!

// .sgtsrc.js
{
  endpoint?: string;
  json?: string;
  output?: string;
  codegenMethods?: boolean;
  codegenReactHooks?: boolean;
  codegenVueHooks?: boolean;
  codegenTemplates?: boolean;
  customScalars?: { [x: string]: string };
  header?: string;
  prefix?: string;
  suffix?: string;
  compileToJs?: boolean;
  download?: string;
}

Then in you can use the command generate

sgts generate <env?>

TIP

The generate command will by default always load your .env and your .env.development file so you can use your environnement variables in your configuration file

# Environnement/Stage

The optional param of generate is a string refering to the environnement file you want to use

Exemple:

.env.testing

API_URL=http://localhost:4000/graphql

.sgtsrc.js

module.exports = {
  endpoint: process.env.API_URL,
  output: './generated.ts',
};
sgts generate testing