func NewIntegrationClient()

in internal/apiclient/options.go [104:155]


func NewIntegrationClient(o IntegrationClientOptions) {
	if options == nil {
		options = new(IntegrationClientOptions)
	}

	options.TokenCheck = o.TokenCheck
	options.SkipCache = o.SkipCache
	options.DebugLog = o.DebugLog
	options.PrintOutput = o.PrintOutput
	options.NoOutput = o.NoOutput
	options.SuppressWarnings = o.SuppressWarnings

	// initialize logs
	clilog.Init(options.DebugLog, options.PrintOutput, options.NoOutput, options.SuppressWarnings)

	cliPref, err := readPreferencesFile()
	if err != nil {
		clilog.Debug.Println(err)
	}

	if cliPref != nil {
		options.ProjectID = cliPref.Project
		options.Region = cliPref.Region
		options.ProxyUrl = cliPref.ProxyUrl
		options.Token = cliPref.Token
		options.TokenCheck = cliPref.Nocheck
		if cliPref.Api != "" {
			options.Api = cliPref.Api
		}
	}

	if o.Region != "" {
		options.Region = o.Region
	}
	if o.Token != "" {
		options.Token = o.Token
	}
	if o.ServiceAccount != "" {
		options.ServiceAccount = o.ServiceAccount
	}
	if o.ProjectID != "" {
		options.ProjectID = o.ProjectID
	}
	if o.ExportToFile != "" {
		options.ExportToFile = o.ExportToFile
	}
	if o.Api == "" {
		options.Api = o.Api
	}

	options.ConflictsAreErrors = true
}