Skip to content

codescalersinternships/Datetime-client-RawanMostafa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datetime Client

This repository implements an http datetime client that accepts the response of a datetime server

Table of Contents

Installation

  1. Clone the repository

    git clone https://github.com/codescalersinternships/Datetime-client-RawanMostafa.git
  2. Install the dependencies

    go mod download

Usage

You can configure our client using different ways:

1. Using flags

 go run cmd/main.go [flags]

Flags:

  • baseUrl=BASEURL
  • port=PORT
  • endpoint=ENDPOINT

2. Using environment variables

This is used in case of no passed flags

 export VARNAME="my value"
 go run cmd/main.go 

Environment variables:

  • DATETIME_BASEURL
  • DATETIME_PORT
  • DATETIME_ENDPOINT

2. Using the default configurations

Our application provides default configurations in case no flags are provided and environment variables aren't set

 go run cmd/main.go 

Default configs:

  const defaltBaseUrl = "http://localhost"
  const defaultEndpoint = "/datetime"
  const defaultPort = "8083"

Extra Utilities

  • Check this function to get environment variables : decideConfigs
  • Check this function to get the flags : getFlags

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages