about summary refs log tree commit diff
path: root/ops/besadii/main.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-21T22·31+0000
committerVincent Ambo <tazjin@google.com>2020-02-21T22·31+0000
commit5058f3928a13e73a72a86e685519ba8be7ca8714 (patch)
tree46379cd3753863f599913b056000fcf421bcd5de /ops/besadii/main.go
parent0a34810e274bb2ca3dc8764733ec23b6b878d5bc (diff)
feat(ops/besadii): Read sourcehut token from secrets file on disk
Diffstat (limited to 'ops/besadii/main.go')
-rw-r--r--ops/besadii/main.go14
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")
+	}
+
 }