From 6d904c724bc655a79f1afbd6744302faeeae3ae9 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 4 Dec 2021 04:31:19 +0100 Subject: [PATCH] Add hostname to config --- .gitignore | 3 ++- config/config.go | 9 +++++---- ezshare.example.toml | 5 +++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 72c916e..abc049e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp/* -ezshare.toml \ No newline at end of file +ezshare.toml +ezshare.test.toml \ No newline at end of file diff --git a/config/config.go b/config/config.go index 916bc9a..097db91 100644 --- a/config/config.go +++ b/config/config.go @@ -16,7 +16,6 @@ import ( ) type Config struct { - LogLevel string `toml:"LogLevel"` Server *ServerConfig `toml:"Server"` Client *ClientConfig `toml:"Client"` location string @@ -27,8 +26,10 @@ type CertificatePaths struct { } type ServerConfig struct { - GRPC *ServerGRPCConfig `toml:"GRPC"` - HTTP *ServerHTTPConfig `toml:"HTTP"` + LogLevel string `toml:"LogLevel"` + Hostname string `toml:"Hostname"` + GRPC *ServerGRPCConfig `toml:"GRPC"` + HTTP *ServerHTTPConfig `toml:"HTTP"` } type ServerStoreConfig struct { Type string `toml:"Type"` @@ -54,8 +55,8 @@ type ClientConfig struct { func FromDefault() *Config { cfg := &Config{ - LogLevel: "INFO", Server: &ServerConfig{ + LogLevel: "INFO", GRPC: &ServerGRPCConfig{ ListenAddr: ":50051", CACerts: &CertificatePaths{}, diff --git a/ezshare.example.toml b/ezshare.example.toml index 5d1a562..81d0d1c 100644 --- a/ezshare.example.toml +++ b/ezshare.example.toml @@ -7,6 +7,11 @@ # Default: INFO LogLevel = "INFO" +# Server hostname +# Used for generating links +# Required +Hostname = "localhost" + # Storage configuration [Server.Store] # How server stores file