utils

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EhridRegex = `e[A-Z]{6}[0-9]{3}`

EhridRegex Regex for eHrid.

Variables

View Source
var SeededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano()))

SeededRand Seeded random

View Source
var Validate *validator.Validate

Validate -_-

Functions

func GenerateEHrid

func GenerateEHrid() string

GenerateEHrid generates new eHrid

func GetTimeNow

func GetTimeNow() *time.Time

GetTimeNow Gets current time

Types

type KeyServerConfig added in v0.3.1

type KeyServerConfig struct {
	URL string `env:"KEY_SERVER_URL, required"`
}

KeyServerConfig Configuration of KeyServer.

func LoadKeyServerConfig added in v0.3.1

func LoadKeyServerConfig(ctx context.Context) (*KeyServerConfig, error)

LoadKeyServerConfig Load KeyServer config.

func (*KeyServerConfig) GetURL added in v0.3.1

func (c *KeyServerConfig) GetURL(path string) string

GetURL Gets configured url with given path set. It does URL verification but it also ensures that a valid URL comes out of it, no matter if the original one (passed to ENV) included some path or trailing slash etc.

type VerificationServerConfig added in v0.3.1

type VerificationServerConfig struct {
	AdminURL  string `env:"VERIFICATION_SERVER_ADMIN_URL, required"`
	DeviceURL string `env:"VERIFICATION_SERVER_DEVICE_URL, required"`
	AdminKey  string
	DeviceKey string
}

VerificationServerConfig Configuration of Verification server.

func LoadVerificationServerConfig added in v0.3.1

func LoadVerificationServerConfig(ctx context.Context) (*VerificationServerConfig, error)

LoadVerificationServerConfig Load Verification server config.

func (*VerificationServerConfig) GetAdminURL added in v0.3.1

func (c *VerificationServerConfig) GetAdminURL(path string) string

GetAdminURL Gets configured admin url with given path set. It does URL verification but it also ensures that a valid URL comes out of it, no matter if the original one (passed to ENV) included some path or trailing slash etc.

func (*VerificationServerConfig) GetDeviceURL added in v0.3.1

func (c *VerificationServerConfig) GetDeviceURL(path string) string

GetDeviceURL Gets configured device url with given path set. It does URL verification but it also ensures that a valid URL comes out of it, no matter if the original one (passed to ENV) included some path or trailing slash etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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