Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Environment = &Config{}
Functions ¶
func LoadEnvironment ¶
func LoadEnvironment() error
func TryWriteJson ¶ added in v0.2.0
Try to marshal data and write it to io.Writer
func TryWriteJsonResponse ¶ added in v0.2.0
func TryWriteJsonResponse(w http.ResponseWriter, code int, data any) error
Try to marshal data and write it to http response. Writes a 500 error if it fails to marshal.
func WriteJsonResponse ¶
func WriteJsonResponse(w http.ResponseWriter, code int, data any) bool
Invokes TryWriteJsonResponse. StdOut and returns a false on error
Types ¶
type Config ¶
type Config struct {
// Env is the environment to run the server in.
// Either "production" or "development".
// Optional, ENV: Defaults to "development"
Env string
// The secret key used to sign and verify JWT access tokens.
// Please ensure this is at least 32 characters long, random and not guessable.
// Required, JWT_ACCESS_SECRET
JwtAccessSecret string
// The secret key used to sign and verify JWT refresh tokens.
// Please ensure this is at least 32 characters long, random and not guessable.
// Required, JWT_REFRESH_SECRET
JwtRefreshSecret string
// The port for the server to listen on.
// Optional, PORT: Defaults to 3000
Port int
}
Click to show internal directories.
Click to hide internal directories.