MCPcopy
hub / github.com/hasura/graphql-engine / WriteConfig

Method WriteConfig

cli/cli.go:807–827  ·  view source on GitHub ↗

WriteConfig writes the configuration from ec.Config or input config

(config *Config)

Source from the content-addressed store, hash-verified

805
806// WriteConfig writes the configuration from ec.Config or input config
807func (ec *ExecutionContext) WriteConfig(config *Config) error {
808 var op errors.Op = "cli.ExecutionContext.WriteConfig"
809 var cfg *Config
810 if config != nil {
811 cfg = config
812 } else {
813 cfg = ec.Config
814 }
815 buf := new(bytes.Buffer)
816 encoder := yaml.NewEncoder(buf)
817 encoder.SetIndent(2)
818 err := encoder.Encode(cfg)
819 if err != nil {
820 return errors.E(op, err)
821 }
822 err = ioutil.WriteFile(ec.ConfigFile, buf.Bytes(), 0644)
823 if err != nil {
824 return errors.E(op, err)
825 }
826 return nil
827}
828
829type DefaultAPIPath string
830

Callers 4

runMethod · 0.80
createFilesMethod · 0.80
UpdateProjectV3Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected