config

package
v0.0.0-...-0362a01 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSettings

func ParseSettings()

ParseSettings parses the config file

Types

type Data

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

	Connections struct {
		Email                EmailConfig
		PostgreSQLConnection PostgreSQLConnection
		Logging              struct {
			IrcHost       string
			IrcChannel    string
			IrcImpChannel string
		}
	}

	Web struct {
		BaseURL string
	}

	App struct {
		CryptPepper string

		Proposals struct {
			StartMonth                uint
			TotalRuntimeMonths        uint
			TotalGrantValue           uint
			GrantIntervalMonths       uint
			MaxGrantValue             uint
			MaxLargeGrantsPerMonth    uint
			SmallGrantValueThreshold  uint
			SmallGrantVetoThreshold   uint
			SmallGrantVoteThreshold   uint
			SmallGrantVoteRuntimeDays uint
		}

		Templates Templates
	}
}

Data holds all of polly's app settings

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

type EmailConfig

type EmailConfig struct {
	AdminEmail string
	ReplyTo    string
	Mailman    struct {
		Name          string
		Address       string
		BounceAddress string
	}
	SMTP struct {
		User     string
		Password string
		Server   string
		Port     int
	}
	IMAP 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 PostgreSQLConnection

type PostgreSQLConnection struct {
	User     string
	Password string
	Host     string
	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 {
	Invitation         EmailTemplate
	ModerationProposal EmailTemplate
	ProposalAccepted   EmailTemplate
	ProposalStarted    EmailTemplate
}

Templates holds all email templates

Jump to

Keyboard shortcuts

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