diff options
author | Vincent Ambo <tazjin@google.com> | 2020-02-21T22·31+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-02-21T22·31+0000 |
commit | 5058f3928a13e73a72a86e685519ba8be7ca8714 (patch) | |
tree | 46379cd3753863f599913b056000fcf421bcd5de /ops | |
parent | 0a34810e274bb2ca3dc8764733ec23b6b878d5bc (diff) |
feat(ops/besadii): Read sourcehut token from secrets file on disk
Diffstat (limited to 'ops')
-rw-r--r-- | ops/besadii/main.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ops/besadii/main.go b/ops/besadii/main.go index c417cb0a1279..4bb5c59a1cb2 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -77,7 +77,7 @@ cat built-paths | cachix push tazjin`}, } // Trigger a build of a given branch & commit on builds.sr.ht -func triggerBuild(branch, commit string) { +func triggerBuild(token, branch, commit string) { build := Build{ Manifest: prepareManifest(commit), Note: fmt.Sprintf("Build of 'master' at '%s'", commit), @@ -94,12 +94,7 @@ func triggerBuild(branch, commit string) { log.Fatalln("[ERROR] failed to create an HTTP request:", err) } - token := fmt.Sprintf("token %s", os.Getenv("SRHT_TOKEN")) - if token == "" { - log.Fatalln("[ERROR] sourcehut token is not set") - } - - req.Header.Add("Authorization", ) + req.Header.Add("Authorization", token) req.Header.Add("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) @@ -121,4 +116,9 @@ func triggerBuild(branch, commit string) { func main() { triggerBuild("master", "c5806a44a728d5a46878f54de7b695321a38559c") + token, err := ioutil.ReadFile("/etc/secrets/srht-token") + if err != nil { + log.Fatalln("[ERROR] sourcehot token could not be read") + } + } |