config

package
v0.0.0-...-63da400 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Port           int    `default:"3001"`
	ResetToken     string `default:"supersecret"`
	AllowedDomains []string
}

API is the api-related configuration struct

type App

type App struct {
	Name string `default:""`
	Link string `default:""`
}

App is the app-related configuration struct App is referring the the whole app where the service is deployed

type Config

type Config struct {
	API    API
	DB     DB
	Email  Email
	JWT    JWT
	Links  Links
	App    App
	OAuth2 OAuth2
}

Config represents the global config of the service

func LoadFromEnv

func LoadFromEnv() (Config, error)

LoadFromEnv loads the configuration file and populate the Config struct

type DB

type DB struct {
	ConnectionString string `default:"postgres://user:pass@localhost/app"`
	Roles            struct {
		Anonymous string `default:"anonymous"`
		User      string `default:"normal_user"`
	}
}

DB is the database-related configuration struct

type Email

type Email struct {
	From string
	Host string
	Port int
	Auth struct {
		User string
		Pass string
	}
}

Email is the email-related configuration struct

type JWT

type JWT struct {
	Exp    int    `default:"24"`
	Secret string `default:"supersecret"`
}

JWT is the jwt-related configuration struct

type Links struct {
	Reset   string `default:"http://localhost/reset/%v"`
	Confirm string `default:"http://localhost/confirm/%v?token=%v"`
}

Links is the links-related configuration struct

type OAuth2

type OAuth2 struct {
	State string `default:"random-state"`
}

OAuth2 State is the same string that was defined to retrive the access token

Jump to

Keyboard shortcuts

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