Add hostname to config

This commit is contained in:
Torjus Håkestad 2021-12-04 04:31:19 +01:00
parent 31c3a6740a
commit 6d904c724b
3 changed files with 12 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
tmp/* tmp/*
ezshare.toml ezshare.toml
ezshare.test.toml

View File

@ -16,7 +16,6 @@ import (
) )
type Config struct { type Config struct {
LogLevel string `toml:"LogLevel"`
Server *ServerConfig `toml:"Server"` Server *ServerConfig `toml:"Server"`
Client *ClientConfig `toml:"Client"` Client *ClientConfig `toml:"Client"`
location string location string
@ -27,8 +26,10 @@ type CertificatePaths struct {
} }
type ServerConfig struct { type ServerConfig struct {
GRPC *ServerGRPCConfig `toml:"GRPC"` LogLevel string `toml:"LogLevel"`
HTTP *ServerHTTPConfig `toml:"HTTP"` Hostname string `toml:"Hostname"`
GRPC *ServerGRPCConfig `toml:"GRPC"`
HTTP *ServerHTTPConfig `toml:"HTTP"`
} }
type ServerStoreConfig struct { type ServerStoreConfig struct {
Type string `toml:"Type"` Type string `toml:"Type"`
@ -54,8 +55,8 @@ type ClientConfig struct {
func FromDefault() *Config { func FromDefault() *Config {
cfg := &Config{ cfg := &Config{
LogLevel: "INFO",
Server: &ServerConfig{ Server: &ServerConfig{
LogLevel: "INFO",
GRPC: &ServerGRPCConfig{ GRPC: &ServerGRPCConfig{
ListenAddr: ":50051", ListenAddr: ":50051",
CACerts: &CertificatePaths{}, CACerts: &CertificatePaths{},

View File

@ -7,6 +7,11 @@
# Default: INFO # Default: INFO
LogLevel = "INFO" LogLevel = "INFO"
# Server hostname
# Used for generating links
# Required
Hostname = "localhost"
# Storage configuration # Storage configuration
[Server.Store] [Server.Store]
# How server stores file # How server stores file