config

package
v0.0.0-...-1ad76dd Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: AGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSettings

func ParseSettings(configFile string)

ParseSettings parses the config file

Types

type AMQPConnection

type AMQPConnection struct {
	User     string
	Password string
	Host     string
	Port     int
	Broker   string
	Exchange string
	Queue    string
}

AMQPConnection contains all of the db configuration values

func (*AMQPConnection) Marshal

func (c *AMQPConnection) Marshal() string

Marshal returns an AMQP "Connection String"

type Data

type Data struct {
	API struct {
		BaseURL         string
		PathPrefix      string
		Bind            string
		SwaggerAPIPath  string
		SwaggerPath     string
		SwaggerFilePath string
		ImageFilePath   string
	}

	Connections struct {
		Logger     LoggerConnection
		PostgreSQL PostgreSQLConnection
		AMQP       AMQPConnection
		Email      EmailConfig
		PayPal     string
		Stripe     string
	}

	Processing struct {
		DonationCutBudget int64
	}

	PaymentProviders struct {
		PayPal struct {
			ClientID string
			Secret   string
		}
		Stripe struct {
			Key    string
			Secret string
		}
		Hbci struct {
			Name     string
			UserID   string
			BankCode string
			Pin      string
			URL      string
		}
		Bitpay struct {
			Pem string
			URL string
		}
	}

	EmailTemplates Templates

	Web struct {
		BaseURL  string
		ImageURL string
	}
}

Data holds all API settings

var (
	// Settings contains the parsed configuration values
	Settings *Data
)

type EmailConfig

type EmailConfig struct {
	AdminEmail string
	ReplyTo    string
	SMTP       struct {
		User     string
		Password string
		Server   string
		Port     int
	}
}

EmailConfig contains all email settings

type EmailTemplate

type EmailTemplate struct {
	Subject string
	Text    string
	HTML    string
}

EmailTemplate holds all values of one email template

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a clever config parser

func NewHandler

func NewHandler(fileName string, unmarshalStruct interface{}, notificationChannel chan interface{}) *Handler

NewHandler returns a new config handler

func (*Handler) CurrentData

func (ch *Handler) CurrentData() interface{}

CurrentData returns the current config data

func (*Handler) LastReadValid

func (ch *Handler) LastReadValid() bool

LastReadValid returns whether the last parse succeeded

func (*Handler) Rescan

func (ch *Handler) Rescan()

Rescan parses the config file again

func (*Handler) SetRescanInterval

func (ch *Handler) SetRescanInterval(interval uint16)

SetRescanInterval controls how often the config should be rescanned

type LoggerConnection

type LoggerConnection struct {
	Protocol string
	Address  string
}

LoggerConnection contains all of the logger settings

type PostgreSQLConnection

type PostgreSQLConnection struct {
	User     string
	Password string
	Host     string
	Port     int
	DbName   string
	SslMode  string
}

PostgreSQLConnection contains all of the db configuration values

func (*PostgreSQLConnection) Marshal

func (c *PostgreSQLConnection) Marshal() string

Marshal returns a "Connection String" with escaped values of all non-empty fields as described at http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING

type Templates

type Templates struct {
	PaymentConfirmation EmailTemplate
}

Templates holds all email templates

Jump to

Keyboard shortcuts

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