config

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

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

Go to latest
Published: Jul 7, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config aggregates the necessary material to configure the wints daemon

Index

Constants

This section is empty.

Variables

View Source
var (
	//DateTimeLayout expresses the expected format for a date + time
	DateTimeLayout = "02/01/2006 15:04"
	//DateLayout expresses the expected format for a date
	DateLayout = "02/01/2006"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Feeder      Feeder
	Db          Db
	Mailer      mail.Config
	HTTPd       HTTPd
	Majors      []string
	Journal     Journal
	Internships Internships
	Crons       Crons
}

Config aggregates all the subcomponents configuration parameters

type Crons

type Crons struct {
	//NewsLetters is the waiting time between two news letters
	NewsLetters string
	//Surveys is the waiting time between two scan for missing surveys
	Surveys string
	//Idles is the waiting time between two scan for missing student connections
	Idles string
}

Crons list the waiting periods for some period tasks

type Db

type Db struct {
	ConnectionString string
}

Db configures the database connection string

type Deadline

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

Deadline is a simple wrapper to express either durations or date

func AbsoluteDeadline

func AbsoluteDeadline(t time.Time) Deadline

AbsoluteDeadline returns a deadline from a timestamp

func (*Deadline) UnmarshalText

func (d *Deadline) UnmarshalText(text []byte) error

UnmarshalText parse either duration or date

func (*Deadline) Value

func (d *Deadline) Value(from time.Time) time.Time

Value returns the concrete deadline depending on its type

type Duration

type Duration struct {
	time.Duration
}

Duration allows to parse duration expressed using toml

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText parse durations

type Feeder

type Feeder struct {
	Login      string
	Password   string
	URL        string
	Frequency  Duration
	Promotions []string
	Encoding   string
}

Feeder configures the feeder than scan conventions

type HTTPd

type HTTPd struct {
	InsecureListen string
	WWW            string
	Assets         string
	Listen         string
	Certificate    string
	PrivateKey     string
	Rest           Rest
}

HTTPd configures the http daemon

type Internships

type Internships struct {
	Majors      []string
	Promotions  []string
	Reports     []Report
	Surveys     []Survey
	LatePenalty int
	Version     string
}

Internships declare the internship organization

func (Internships) ValidMajor

func (i Internships) ValidMajor(m string) bool

ValidMajor tests if a given major is supported

func (Internships) ValidPromotion

func (i Internships) ValidPromotion(p string) bool

ValidPromotion tests if a promotion is supported

type Journal

type Journal struct {
	Path string
	Key  string
}

Journal configures the logging system

type Report

type Report struct {
	Kind     string
	Delivery Deadline
	Review   Duration
	Reminder Duration
	Grade    bool
}

Report configures a report definition

type Rest

type Rest struct {
	SessionLifeTime        Duration
	RenewalRequestLifetime Duration
	//The endpoints prefix
	Prefix string
}

Rest configures the rest service

type Survey

type Survey struct {
	Invitation Deadline
	Deadline   Duration
	Kind       string
}

Survey configures a survey definition

Jump to

Keyboard shortcuts

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