Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPrivateKey ¶
func LoadPrivateKey(keyPath string) (*ecdsa.PrivateKey, error)
LoadPrivateKey loads given ECDSA private key PEM file.
Types ¶
type Config ¶
type Config struct { MySQL MySQLConfig Redis RedisConfig Mail MailConfig }
Config is wrapper for all configurations.
type Environment ¶
type Environment struct { RDB *sql.DB KVS redis.Conn MailFrom string Mail service.Mail PrivateKey *ecdsa.PrivateKey }
Environment holds RDB Connection, KVS Connection, and Private KEY.
func NewEnvironment ¶
func NewEnvironment(cfg Config, keyPath string) (*Environment, error)
NewEnvironment returns a new Environment object.
func (Environment) GetUserRepository ¶
func (env Environment) GetUserRepository() repository.UserRepository
GetUserRepository generates UserRepository instance fron env itself.
func (Environment) SendVerifyMail ¶
func (env Environment) SendVerifyMail(from, to, sessid string) error
SendVerifyMail sends address verification mail using sendgrid.
type MailConfig ¶
type MailConfig struct { FromAddr string `long:"email" env:"EMAIL_ADDR"` APIKey string `long:"sg-apikey" env:"SENDGRID_APIKEY" value-name:"SENDGRID_APIKEY" required:"yes"` }
MailConfig holds configuration to use to sendgrid API. This struct can also be used for go-flags.
type MySQLConfig ¶
type MySQLConfig struct { Addr string `long:"mysql-addr" env:"MYSQL_ADDR" value-name:"MYSQL_ADDR" default:"127.0.0.1:3306"` User string `long:"mysql-user" env:"MYSQL_USER" value-name:"MYSQL_USER" default:"root"` Password string `long:"mysql-password" env:"MYSQL_PASSWORD" value-name:"MYSQL_PASSWORD" default:""` DBName string `long:"mysql-db" env:"MYSQL_DB" value-name:"MYSQL_DB" default:"ident"` }
MySQLConfig holds configurations for connect to MySQL server. This struct can also be used for go-flags.
type RedisConfig ¶
type RedisConfig struct {
Addr string `long:"redis-addr" env:"REDIS_ADDR" value-name:"REDIS_ADDR" default:"127.0.0.1:6379"`
}
RedisConfig holds configurations for connect to Redis server. This struct can also be used for go-flags.