Created
October 12, 2024 02:27
-
-
Save suzuki-shunsuke/822f11c9d52ea71bc051e260a6f8adb4 to your computer and use it in GitHub Desktop.
Example of zalando/go-keyring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/zalando/go-keyring" | |
) | |
func main() { | |
if err := run(); err != nil { | |
log.Fatal(err) | |
} | |
} | |
func run() error { | |
// | |
service := "test-aquaproj-aqua" | |
user := "GITHUB_TOKEN" | |
secret, err := keyring.Get(service, user) | |
if err != nil { | |
return err | |
} | |
fmt.Println("GITHUB_TOKEN", secret) | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/zalando/go-keyring" | |
) | |
func main() { | |
if err := run(); err != nil { | |
log.Fatal(err) | |
} | |
} | |
func run() error { | |
service := "test-aquaproj-aqua" | |
user := "GITHUB_TOKEN" | |
password := "secret" | |
if err := keyring.Set(service, user, password); err != nil { | |
return err | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment