This repository implements an http datetime client that accepts the response of a datetime server
-
Clone the repository
git clone https://github.com/codescalersinternships/Datetime-client-RawanMostafa.git
-
Install the dependencies
go mod download
You can configure our client using different ways:
go run cmd/main.go [flags]
- baseUrl=BASEURL
- port=PORT
- endpoint=ENDPOINT
This is used in case of no passed flags
export VARNAME="my value"
go run cmd/main.go
- DATETIME_BASEURL
- DATETIME_PORT
- DATETIME_ENDPOINT
Our application provides default configurations in case no flags are provided and environment variables aren't set
go run cmd/main.go
const defaltBaseUrl = "http://localhost"
const defaultEndpoint = "/datetime"
const defaultPort = "8083"
- Check this function to get environment variables :
decideConfigs
- Check this function to get the flags :
getFlags