/
api.go
52 lines (50 loc) · 1.31 KB
/
api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright © 2019 Circonus, Inc. <support@circonus.com>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package config
// func validateAPIOptions() error {
// apiKey := viper.GetString(KeyAPITokenKey)
// apiApp := viper.GetString(KeyAPITokenApp)
// apiURL := viper.GetString(KeyAPIURL)
// apiCAFile := viper.GetString(KeyAPICAFile)
//
// // API is required for reverse and/or statsd
//
// if apiKey == "" {
// return errors.New("API key is required")
// }
//
// if apiApp == "" {
// return errors.New("API app is required")
// }
//
// if apiURL == "" {
// return errors.New("API URL is required")
// }
//
// if apiURL != defaults.APIURL {
// parsedURL, err := url.Parse(apiURL)
// if err != nil {
// return errors.Wrap(err, "invalid API URL")
// }
// if parsedURL.Scheme == "" || parsedURL.Host == "" || parsedURL.Path == "" {
// return errors.Errorf("invalid API URL (%s)", apiURL)
// }
// }
//
// // NOTE the api ca file doesn't come from the cosi config
// if apiCAFile != "" {
// f, err := verifyFile(apiCAFile)
// if err != nil {
// return err
// }
// viper.Set(KeyAPICAFile, f)
// }
//
// viper.Set(KeyAPITokenKey, apiKey)
// viper.Set(KeyAPITokenApp, apiApp)
// viper.Set(KeyAPIURL, apiURL)
//
// return nil
// }