Hi,
I have solve the problem and it works now. Thanks.
On Monday, September 30, 2019 at 11:06:20 AM UTC+3, Afriyie Abraham Kwabena
wrote:
>
> Hi,
>
> I have applied similar scenario to the function below but am not getting
> the Ip address and the port number. Below is the function
>
> var add
Hi,
I have applied similar scenario to the function below but am not getting
the Ip address and the port number. Below is the function
var addr string
func init(){
var conf Config
if _, err := toml.Decode("config.toml", &conf); err != nil {
// handle error
}
addr = net.JoinHost
Use net.JoinHostPort to concatenate the values you have in the struct
and pass the to http.Server struct.
if _, err := toml.Decode("config.toml", &conf); err != nil {
// handle error
}
addr, err := net.JoinHostPort(conf.Address, conf.PORT)
if err != nil {
// handle error
}
s
Hi,
How I can use the .toml file to parse IP address and port to simple http
server instead of using flags
I have a config.toml file which contains these parameters in
PORT = "8000"
Address = "localhost"
//Parameters type struct as
type Config struct {
PORTstring
Address string
}
I can lo