Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

availability to set token wo env vars #7

Closed
wants to merge 3 commits into from
Closed

availability to set token wo env vars #7

wants to merge 3 commits into from

Conversation

aluvare
Copy link
Contributor

@aluvare aluvare commented Oct 12, 2021

I've been trying to use multiple Nightscout instances with different tokens, with this, you can set the Token without use env var (because each instance will have a different one):

package main

import (
        "log"

        "github.com/ecc1/nightscout"
)

func main() {
        site, err := nightscout.Site("https://XXXXXX.herokuapp.com")
        site.Token = "xxxx-xxxxxxxx"
        if err != nil {
                log.Fatal(err)
        }
        entries, err := site.DownloadEntries(10)
        if err != nil {
                log.Fatal(err)
        }
        entries.Print()
}

@aluvare aluvare closed this Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant