Server

Server config includes all details required for a server to run the project. This include Path, App Name and Port, etc

Server Config

config/server.go

type ServerConfig struct {
   *fiber.App
   TemplateEngine *html.Engine
   Name           string `mapstructure:"APP_NAME" yaml:"name" env:"APP_NAME" env-default:"iSend.to"`
   Version        string `mapstructure:"APP_VERSION" yaml:"version" env:"APP_VERSION" env-default:"dev"`
   Mode           string `mapstructure:"APP_MODE" yaml:"mode" env:"APP_MODE" env-default:"app"`
   Env            string `mapstructure:"APP_ENV" yaml:"env" env:"APP_ENV" env-default:"dev"`
   Key            string `mapstructure:"APP_KEY" yaml:"key" env:"APP_KEY" env-default:"1894cde6c936a294a478cff0a9227fd276d86df6573b51af5dc59c9064edf426"`
   Url            string `mapstructure:"APP_URL" yaml:"url" env:"APP_URL" env-default:"http://localhost"`
   Host           string `mapstructure:"APP_HOST" yaml:"host" env:"APP_HOST" env-default:"localhost"`
   Port           string `mapstructure:"APP_PORT" yaml:"port" env:"APP_PORT" env-default:"8080"`
   Path           string `mapstructure:"APP_PATH" yaml:"path" env:"APP_PATH"`
   ProxyHeader    string `mapstructure:"PROXY_HEADER" yaml:"PROXY_HEADER" env:"PROXY_HEADER" env-default:"*"`
   AssetPath      string `mapstructure:"ASSET_PATH" yaml:"asset_path" env:"ASSET_PATH" env-default:"assets"`
   PublicPath     string `mapstructure:"PUBLIC_PATH" yaml:"public_path" env:"PUBLIC_PATH" env-default:"public"`
   UploadPath     string `mapstructure:"UPLOAD_PATH" yaml:"upload_path" env:"UPLOAD_PATH" env-default:"uploads"`
   StoragePath    string `mapstructure:"STORAGE_PATH" yaml:"storage_path" env:"STORAGE_PATH" env-default:"storage"`
   LogPath        string `mapstructure:"LOG_PATH" yaml:"log_path" env:"LOG_PATH" env-default:"storage/logs"`
   ExecPath       bool   `mapstructure:"EXEC_PATH" yaml:"exec_path" env:"EXEC_PATH" env-default:"false"`
   Debug          bool   `mapstructure:"APP_DEBUG" yaml:"debug" env:"APP_DEBUG" env-default:"true"`
   UploadSize     int    `mapstructure:"UPLOAD_SIZE" yaml:"upload_size" env:"UPLOAD_SIZE" env-default:"400"`
}

Please note that all paths are related to Executable Path of Go binary or Whatever user defines.

If the project is behind any proxy, then we could Client IP by providing values in ProxyHeader

When the project runs the first time, it will create folders for the paths defined in the config variables

Last updated