conf

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLogging added in v1.7.1

func ConfigureLogging(config *LoggingConfig) (*logrus.Entry, error)

Types

type Configuration

type Configuration struct {
	SiteURL string           `json:"site_url" split_words:"true" required:"true"`
	JWT     JWTConfiguration `json:"jwt"`

	SMTP SMTPConfiguration `json:"smtp"`

	Mailer struct {
		Subjects  EmailContentConfiguration `json:"subjects"`
		Templates EmailContentConfiguration `json:"templates"`
	} `json:"mailer"`

	Payment struct {
		Stripe struct {
			Enabled   bool   `json:"enabled"`
			PublicKey string `json:"public_key" split_words:"true"`
			SecretKey string `json:"secret_key" split_words:"true"`
		} `json:"stripe"`
		PayPal struct {
			Enabled  bool   `json:"enabled"`
			ClientID string `json:"client_id" split_words:"true"`
			Secret   string `json:"secret"`
			Env      string `json:"env"`
		} `json:"paypal"`
	} `json:"payment"`

	Downloads struct {
		Provider     string `json:"provider"`
		NetlifyToken string `json:"netlify_token" split_words:"true"`
	} `json:"downloads"`

	Coupons struct {
		URL      string `json:"url"`
		User     string `json:"user"`
		Password string `json:"password"`
	} `json:"coupons"`

	Webhooks struct {
		Order   string `json:"order"`
		Payment string `json:"payment"`
		Update  string `json:"update"`
		Refund  string `json:"refund"`

		Secret string `json:"secret"`
	} `json:"webhooks"`
}

Configuration holds all the per-tenant configuration for gocommerce

func LoadConfig added in v1.1.2

func LoadConfig(filename string) (*Configuration, error)

LoadConfig loads the per-instance configuration from a file

func (*Configuration) ApplyDefaults added in v1.1.2

func (config *Configuration) ApplyDefaults()

ApplyDefaults sets defaults for a Configuration

func (*Configuration) SettingsURL added in v1.2.1

func (c *Configuration) SettingsURL() string

type DBConfiguration added in v1.1.2

type DBConfiguration struct {
	Dialect     string
	Driver      string `required:"true"`
	URL         string `envconfig:"DATABASE_URL" required:"true"`
	Namespace   string
	Automigrate bool
}

DBConfiguration holds all the database related configuration.

type EmailContentConfiguration added in v1.1.2

type EmailContentConfiguration struct {
	OrderConfirmation string `json:"order_confirmation" split_words:"true"`
	OrderReceived     string `json:"order_received" split_words:"true"`
}

EmailContentConfiguration holds the configuration for emails, both subjects and template URLs.

type GlobalConfiguration added in v1.1.2

type GlobalConfiguration struct {
	API struct {
		Host     string
		Port     int `envconfig:"PORT" default:"8080"`
		Endpoint string
	}
	DB                DBConfiguration
	Logging           LoggingConfig `envconfig:"LOG"`
	OperatorToken     string        `split_words:"true"`
	MultiInstanceMode bool
	SMTP              SMTPConfiguration `json:"smtp"`
}

GlobalConfiguration holds all the global configuration for gocommerce

func LoadGlobal added in v1.1.2

func LoadGlobal(filename string) (*GlobalConfiguration, *logrus.Entry, error)

LoadGlobal will construct the core config from the file

type JWTConfiguration added in v1.1.2

type JWTConfiguration struct {
	Secret         string `json:"secret"`
	AdminGroupName string `json:"admin_group_name" split_words:"true"`
}

JWTConfiguration holds all the JWT related configuration.

type LoggingConfig added in v1.7.1

type LoggingConfig struct {
	Level            string                 `mapstructure:"log_level" json:"log_level"`
	File             string                 `mapstructure:"log_file" json:"log_file"`
	DisableColors    bool                   `mapstructure:"disable_colors" split_words:"true" json:"disable_colors"`
	QuoteEmptyFields bool                   `mapstructure:"quote_empty_fields" split_words:"true" json:"quote_empty_fields"`
	TSFormat         string                 `mapstructure:"ts_format" json:"ts_format"`
	Fields           map[string]interface{} `mapstructure:"fields" json:"fields"`
	UseNewLogger     bool                   `mapstructure:"use_new_logger",split_words:"true"`
}

type SMTPConfiguration added in v1.1.8

type SMTPConfiguration struct {
	Host       string `json:"host"`
	Port       int    `json:"port" default:"587"`
	User       string `json:"user"`
	Pass       string `json:"pass"`
	AdminEmail string `json:"admin_email" split_words:"true"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL