Configuration is done via environment variables:
BASEURL
: The Base URL for the Stock API to useAPIKEY
: The API key to useSYMBOL
: The stock ticker symbol to useNDAYS
: the amount of days to return via a GET request
cd ~/go/src/
git clone https://github.com/omgftw/GoLangApiExample.git
go get
go run main.go
docker build -t stock-api .
Set an API key
APIKEY=YOUR_KEY_HERE
Run Docker Hub image:
docker run --rm -e APIKEY="$APIKEY" -p 8080:8080 omgftw/stock-api
Run local image:
docker run --rm -e APIKEY="$APIKEY" -p 8080:8080 stock-api
Open http://127.0.0.1:8080 in your browser
kubectl create secret generic stock-api-secret --from-literal=APIKEY='YOUR_KEY_HERE'
kubectl apply -f kubernetes/
It can be accessed using your kubernetes url at the path /stock-api
Example: http://192.168.64.3/stock-api