Compare commits

...

8 Commits

Author SHA1 Message Date
Gregory Rudolph e67fb8275c
Trying to appease drone 2 years ago
Gregory Rudolph c9ca320b87
Add ENV to build stage 2 years ago
Gregory Rudolph 08c2417014
Testing drone 2 years ago
Gregory Rudolph 0519f8e8cb
Declare env step 2 years ago
Gregory Rudolph 3c040e5352
Didn't like that 2 years ago
Gregory Rudolph 2083ad48f5
Update drone environment 2 years ago
Gregory Rudolph 14d163c058
Add API key for drone automated builds 2 years ago
Gregory Rudolph 852beb656c
Update Drone for other platforms 2 years ago
  1. 13
      .drone.yml
  2. 7
      main.go

13
.drone.yml

@ -5,17 +5,26 @@ name: default @@ -5,17 +5,26 @@ name: default
steps:
- name: Build
image: golang
environment:
NASA_TOKEN:
from_secret: nasa_api
commands:
- go get github.com/reujab/wallpaper
- go vet -v
- go build
- env
- GOOS="linux" go build -ldflags="-w -s -x main.api_key=$NASA_TOKEN" -o SpaceFace-Linux
- GOOS="windows" go build -ldflags="-w -s -x main.api_key=$NASA_TOKEN" -o SpaceFace-Win.exe
- GOOS="darwin" go build -ldflags="-w -s -x main.api_key=$NASA_TOKEN" -o SpaceFace-macOS
- name: gitea_release
image: plugins/gitea-release
settings:
base_url: https://git.nightmare.haus
api_key:
from_secret: gitea_token
files: ./SpaceFace
files:
- ./SpaceFace-Linux
- ./SpaceFace-Win.exe
- ./SpaceFace-macOS
checksum:
- md5
- sha1

7
main.go

@ -2,6 +2,7 @@ package main @@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
@ -12,10 +13,14 @@ import ( @@ -12,10 +13,14 @@ import (
var (
apod APODResponse
api_key string
)
func main() {
resp, err := http.Get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY")
if len(api_key) == 0 {
api_key="DEMO_KEY"
}
resp, err := http.Get(fmt.Sprintf("https://api.nasa.gov/planetary/apod?api_key=%+v", api_key))
if err != nil {
log.Fatalf("\nUnable to get NASA API Response\n")
return

Loading…
Cancel
Save