conf

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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           nconf.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, 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 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