Documentation ¶
Index ¶
- Constants
- func InitializeConfig(release bool)
- func RandomString(n int) string
- type Configuration
- func (c *Configuration) GetDataPath() string
- func (c *Configuration) GetDatabaseType() string
- func (c *Configuration) GetDatabaseURL() *url.URL
- func (c *Configuration) GetJWTAlgorithm() string
- func (c *Configuration) GetJWTExpirationTime() time.Duration
- func (c *Configuration) GetJWTKey() []byte
- func (c *Configuration) GetJWTRefreshTime() time.Duration
- func (c *Configuration) GetPort() int
- func (c *Configuration) GetPublicURL() *url.URL
- func (c *Configuration) IsDevelopment() bool
- func (c *Configuration) IsProduction() bool
- func (c *Configuration) IsProfileActive(profile string) bool
- func (c *Configuration) MigrateDatabase() bool
- type PageRequest
- type Validator
Constants ¶
const ( //JWTAlgorithmHS256 specifies the algorithm name for HS256. JWTAlgorithmHS256 = "HS256" //JWTAlgorithmHS384 specifies the algorithm name for HS384. JWTAlgorithmHS384 = "HS384" //JWTAlgorithmHS512 specifies the algorithm name for HS512. JWTAlgorithmHS512 = "HS512" )
const (
// DefaultPageSize defines the default page size.
DefaultPageSize = 10
)
const (
// RoleAdmin is the string constant for identifying a user with admin privileges.
RoleAdmin = "ADMIN"
)
Variables ¶
This section is empty.
Functions ¶
func InitializeConfig ¶
func InitializeConfig(release bool)
InitializeConfig loads the application configuration using environment properties respecting '.env' file.
func RandomString ¶
RandomString return a string of the form '[a-zA-Z0-9]{n}'.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration is a struct which holds all configurable properties.
func (*Configuration) GetDataPath ¶
func (c *Configuration) GetDataPath() string
GetDataPath gets the base path for storing documents.
func (*Configuration) GetDatabaseType ¶
func (c *Configuration) GetDatabaseType() string
GetDatabaseType gets the configured type of database. Can be 'sqlite3', 'postgres' or 'mysql'.
func (*Configuration) GetDatabaseURL ¶
func (c *Configuration) GetDatabaseURL() *url.URL
GetDatabaseURL returns the URL for establishing the connection to the database.
func (*Configuration) GetJWTAlgorithm ¶
func (c *Configuration) GetJWTAlgorithm() string
GetJWTAlgorithm gets the configured algorithm for issueing and verifying JWTs.
func (*Configuration) GetJWTExpirationTime ¶
func (c *Configuration) GetJWTExpirationTime() time.Duration
GetJWTExpirationTime gets the expiration time of access tokens.
func (*Configuration) GetJWTKey ¶
func (c *Configuration) GetJWTKey() []byte
GetJWTKey gets the configured encryption/decryption key for issueing and verifying JWTs.
func (*Configuration) GetJWTRefreshTime ¶
func (c *Configuration) GetJWTRefreshTime() time.Duration
GetJWTRefreshTime gets the expiration time of refresh tokens.
func (*Configuration) GetPort ¶
func (c *Configuration) GetPort() int
GetPort gets the configured listening port of the HTTP server.
func (*Configuration) GetPublicURL ¶
func (c *Configuration) GetPublicURL() *url.URL
GetPublicURL gets the configured server base URL for public access.
func (*Configuration) IsDevelopment ¶
func (c *Configuration) IsDevelopment() bool
IsDevelopment returns a boolean value indicating whether the development profile is currently active.
Development profile is only recognized as active when 'production' profile is not set.
func (*Configuration) IsProduction ¶
func (c *Configuration) IsProduction() bool
IsProduction returns a boolean value indicating whether the development profile is currently active.
func (*Configuration) IsProfileActive ¶
func (c *Configuration) IsProfileActive(profile string) bool
IsProfileActive checks whether the given profile is configured as active.
func (*Configuration) MigrateDatabase ¶
func (c *Configuration) MigrateDatabase() bool
MigrateDatabase returns a boolean value indicating whether the migrations should be run.
type PageRequest ¶
PageRequest defines a struct for declaring pagin information for requests.