func (c *Config) GetRetryAttempt() int {
	if c.RetryAttempt != 0 {
		return c.RetryAttempt
	}
	return 3
}
Returns the retry attempt number
package main
import (
	"encoding/json"
	"fmt"
	"github.com/wunderlist/hamustro/src/dialects"
	"github.com/wunderlist/hamustro/src/dialects/abs"
	"github.com/wunderlist/hamustro/src/dialects/aqs"
	"github.com/wunderlist/hamustro/src/dialects/file"
	"github.com/wunderlist/hamustro/src/dialects/s3"
	"github.com/wunderlist/hamustro/src/dialects/sns"
	"io/ioutil"
	"log"
	"os"
	"runtime"
	"strconv"
	"strings"
)
type Config struct {
	LogFile           string      `json:"logfile"`
	Dialect           string      `json:"dialect"`
	MaxWorkerSize     int         `json:"max_worker_size"`
	MaxQueueSize      int         `json:"max_queue_size"`
	RetryAttempt      int         `json:"retry_attempt"`
	BufferSize        int         `json:"buffer_size"`
	MaskedIP          bool        `json:"masked_ip"`
	SpreadBufferSize  bool        `json:"spread_buffer_size"`
	Signature         string      `json:"signature"`
	SharedSecret      string      `json:"shared_secret"`
	MaintenanceKey    string      `json:"maintenance_key"`
	AutoFlushInterval int         `json:"auto_flush_interval"`
	AQS               aqs.Config  `json:"aqs"`
	SNS               sns.Config  `json:"sns"`
	ABS               abs.Config  `json:"abs"`
	S3                s3.Config   `json:"s3"`
	File              file.Config `json:"file"`
}
func NewConfig(filename string) *Config {
	file, err := ioutil.ReadFile(filename)
	if err != nil {
		log.Fatal(err)
	}
	var config Config
	if err := json.Unmarshal(file, &config); err != nil {
		log.Fatal(err)
	}
	config.UpdateAutoFlushIntervalToSeconds()
	return &config
}
func (c *Config) IsValid() bool {
	return c.Dialect != "" && c.SharedSecret != ""
}
func (c *Config) IsSignatureRequired() bool {
	switch c.Signature {
	case "required":
		return true
	case "optional":
		return false
	default:
		return true
	}
}
func (c *Config) GetMaxWorkerSize() int {
	size, _ := strconv.ParseInt(os.Getenv("HAMUSTRO_MAX_WORKER_SIZE"), 10, 0)
	if size != 0 {
		return int(size)
	}
	if c.MaxWorkerSize != 0 {
		return c.MaxWorkerSize
	}
	return runtime.NumCPU() + 1
}
func (c *Config) GetMaxQueueSize() int {
	size, _ := strconv.ParseInt(os.Getenv("HAMUSTRO_MAX_QUEUE_SIZE"), 10, 0)
	if size != 0 {
		return int(size)
	}
	if c.MaxQueueSize != 0 {
		return c.MaxQueueSize
	}
	return c.GetMaxWorkerSize() * 20
}
func (c *Config) GetPort() string {
	if port := os.Getenv("HAMUSTRO_PORT"); port != "" {
		return port
	}
	return "8080"
}
func (c *Config) GetHost() string {
	if port := os.Getenv("HAMUSTRO_HOST"); port != "" {
		return port
	}
	return "localhost"
}
func (c *Config) GetAddress() string {
	host := c.GetHost()
	if host == "localhost" {
		return ":" + c.GetPort()
	}
	return host + ":" + c.GetPort()
}
func (c *Config) GetBufferSize() int {
	if c.BufferSize != 0 {
		return c.BufferSize
	}
	return (c.GetMaxWorkerSize() * c.GetMaxQueueSize()) * 10
}
func (c *Config) UpdateAutoFlushIntervalToSeconds() {
	c.AutoFlushInterval = c.AutoFlushInterval * 60
}
func (c *Config) IsSpreadBuffer() bool {
	return c.SpreadBufferSize
}
func (c *Config) IsMaskedIP() bool {
	return c.MaskedIP
}