You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I'm a huge fan of environment variables, not everyone is. There should be a hook, initializer, or something else that'll load the variables from ~/.anki_vector/sdk_config.ini
For the unitiated, the file format is as followed
[00507778]
cert = location_of_bot_cert.cert
ip = bot_ip_address
name =bot_name
guid = guid_aka_token
The text was updated successfully, but these errors were encountered:
I haven't added it to the repo, as it is very rough and ready, and probably not for Windows, but I wrapped the vector.New method in this function to do just what you suggest:
func getVector() (*vector.Vector, error) {
botToken := ""
botTarget := ""
home := os.Getenv("HOME")
f, err := ioutil.ReadFile(home + "/.anki_vector/sdk_config.ini")
if err != nil {
return nil, err
}
var re = regexp.MustCompile(`(?m)^\s*([^\s=]+)\s*=\s*(\S+)$`)
for _, m := range re.FindAllStringSubmatch(string(f), -1) {
switch m[1] {
case "ip":
botTarget = m[2]
if !strings.HasPrefix(botTarget, ":443") {
botTarget += ":443"
}
case "guid":
botToken = m[2]
}
}
return vector.New(
vector.WithTarget(botTarget),
vector.WithToken(botToken),
)
}
While I'm a huge fan of environment variables, not everyone is. There should be a hook, initializer, or something else that'll load the variables from ~/.anki_vector/sdk_config.ini
For the unitiated, the file format is as followed
The text was updated successfully, but these errors were encountered: