Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e67fb8275c
|
|||
|
c9ca320b87
|
|||
|
08c2417014
|
|||
|
0519f8e8cb
|
|||
|
3c040e5352
|
|||
|
2083ad48f5
|
|||
|
14d163c058
|
|||
|
852beb656c
|
13
.drone.yml
13
.drone.yml
@ -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
7
main.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user