-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.go
65 lines (51 loc) · 1.06 KB
/
auth.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
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
)
type auth struct {
Account struct
{
clientID string `yaml:"clientID"`
clientSecret string `yaml:"clientSecret"`
redirectURL string `yaml:"redirectURL"`
scopes []string `yaml:"scopes"`
endpoint string `yaml:"endpoint"`
}
}
var c = auth.Account
fmt.Println(c)
type account struct {
clientID string `yaml:"clientID"`
clientSecret string `yaml:"clientSecret"`
redirectURL string `yaml:"redirectURL"`
scopes []string `yaml:"scopes"`
endpoint string `yaml:"endpoint"`
}
func (ac *account)ClientID() string{
return ac.clientID
}
func (ac *account)ClientSecret() string{
return ac.clientSecret
}
func (ac *account)RedirectURL() string{
return ac.redirectURL
}
func (ac *account)Scopes() []string{
return ac.scopes
}
func (ac *account)Endpoint() string{
return ac.endpoint
}
func (c *auth) getAuth() *auth {
yamlFile, err := ioutil.ReadFile("auth.yaml")
if err != nil {
fmt.Println(err.Error())
}
err = yaml.Unmarshal(yamlFile, c)
if err != nil {
fmt.Println(err.Error())
}
return c
}