env.go 315 B

1234567891011121314151617
  1. package config
  2. import (
  3. "fmt"
  4. "os"
  5. "strings"
  6. )
  7. func (c *Config) addEnvVars() error {
  8. authToken := os.Getenv("SQLC_AUTH_TOKEN")
  9. if authToken != "" && !strings.HasPrefix(authToken, "sqlc_") {
  10. return fmt.Errorf("$SQLC_AUTH_TOKEN doesn't start with \"sqlc_\"")
  11. }
  12. c.Cloud.AuthToken = authToken
  13. return nil
  14. }