config

package
v0.0.0-...-686d10b Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChoosePasswordURL

func ChoosePasswordURL() string

ChoosePasswordURL ...

func GenerateEmailVerifyTokenExpiresAt

func GenerateEmailVerifyTokenExpiresAt() time.Time

GenerateEmailVerifyTokenExpiresAt 获取 Email 验证 Token 过期时间

func GeneratePasswordResetTokenExpiresAt

func GeneratePasswordResetTokenExpiresAt() time.Time

GeneratePasswordResetTokenExpiresAt 获取 重置密码 验证 Token 过期时间

func GenerateSessionExpiresAt

func GenerateSessionExpiresAt() time.Time

GenerateSessionExpiresAt 获取 Session 过期时间

func InvalidLinkURL

func InvalidLinkURL() string

InvalidLinkURL ...

func InvalidVerificationLinkURL

func InvalidVerificationLinkURL() string

InvalidVerificationLinkURL ...

func LinkSendFailURL

func LinkSendFailURL() string

LinkSendFailURL ...

func LinkSendSuccessURL

func LinkSendSuccessURL() string

LinkSendSuccessURL ...

func ParseFrameURL

func ParseFrameURL() string

ParseFrameURL ...

func PasswordResetSuccessURL

func PasswordResetSuccessURL() string

PasswordResetSuccessURL ...

func RequestResetPasswordURL

func RequestResetPasswordURL() string

RequestResetPasswordURL ...

func Validate

func Validate()

Validate 校验用户参数合法性

func VerifyEmailSuccessURL

func VerifyEmailSuccessURL() string

VerifyEmailSuccessURL ...

func VerifyEmailURL

func VerifyEmailURL() string

VerifyEmailURL ...

Types

type Config

type Config struct {
	AppName                          string   // 应用名称,必填
	ServerURL                        string   // 服务对外地址,必填
	DatabaseType                     string   // 数据库类型,可选: MongoDB、PostgreSQL
	DatabaseURI                      string   // 数据库地址
	AppID                            string   // 必填
	MasterKey                        string   // 必填
	MasterKeyIps                     []string // 选填,允许使用masterKey的IP列表,默认为[]
	ReadOnlyMasterKey                string   // 只读MasterKey
	ClientKey                        string   // 选填
	JavaScriptKey                    string   // 选填
	DotNetKey                        string   // 选填
	RestAPIKey                       string   // 选填
	AllowClientClassCreation         bool     // 是否允许客户端操作不存在的 class ,默认为 fasle 不允许操作
	EnableAnonymousUsers             bool     // 是否支持匿名用户,默认为 true 支持匿名用户
	VerifyUserEmails                 bool     // 是否需要验证用户的 Email ,默认为 false 不需要验证
	EmailVerifyTokenValidityDuration int      // 邮箱验证 Token 有效期,单位为秒,取值大于等于 0 ,默认为 0 表示不设置 Token 有效期
	MailAdapter                      string   // 邮件发送模块,仅在 VerifyUserEmails=true 时需要配置,可选: smtp ,默认为 smtp
	SMTPServer                       string   // SMTP 邮箱服务器地址,仅在 MailAdapter=smtp 时需要配置
	MailUsername                     string   // SMTP 用户名,仅在 MailAdapter=smtp 时需要配置
	MailPassword                     string   // SMTP 密码,仅在 MailAdapter=smtp 时需要配置
	FileAdapter                      string   // 文件存储模块,可选: Disk、GridFS、Qiniu、Sina、Tencent, 默认为 Disk 本地磁盘存储
	FileDirectAccess                 bool     // 是否允许直接访问文件地址,默认为 true 允许直接访问而不是通过 tomato 中转
	QiniuBucket                      string   // 七牛云存储 Bucket ,仅在 FileAdapter=Qiniu 时需要配置
	QiniuDomain                      string   // 七牛云存储 Domain ,仅在 FileAdapter=Qiniu 时需要配置
	QiniuAccessKey                   string   // 七牛云存储 AccessKey ,仅在 FileAdapter=Qiniu 时需要配置
	QiniuSecretKey                   string   // 七牛云存储 SecretKey ,仅在 FileAdapter=Qiniu 时需要配置
	QiniuZone                        string   // 七牛云存储所在机房,仅在 FileAdapter=Qiniu 时需要配置,可选:Huadong、Huabei、Huanan、Beimei
	SinaBucket                       string   // 新浪云存储 Bucket ,仅在 FileAdapter=Sina 时需要配置
	SinaDomain                       string   // 新浪云存储 Domain ,仅在 FileAdapter=Sina 时需要配置
	SinaAccessKey                    string   // 新浪云存储 AccessKey ,仅在 FileAdapter=Sina 时需要配置
	SinaSecretKey                    string   // 新浪云存储 SecretKey ,仅在 FileAdapter=Sina 时需要配置
	TencentBucket                    string   // 腾讯云存储 Bucket ,仅在 FileAdapter=Tencent 时需要配置
	TencentAppID                     string   // 腾讯云存储 AppID ,仅在 FileAdapter=Tencent 时需要配置
	TencentSecretID                  string   // 腾讯云存储 SecretID ,仅在 FileAdapter=Tencent 时需要配置
	TencentSecretKey                 string   // 腾讯云存储 SecretKey ,仅在 FileAdapter=Tencent 时需要配置
	PushAdapter                      string   // 推送模块,可选:FCM, UMeng,默认为 tomato
	PushChannel                      string   // 推送通道
	PushBatchSize                    int      // 批量推送的大小
	ScheduledPush                    bool     // 是否有推送调度器
	LiveQueryClasses                 string   // LiveQuery 支持的 classe ,多个 class 使用 | 隔开,如: classeA|classeB|classeC
	PublisherType                    string   // 发布者类型,可选:Redis ,默认使用自带的 EventEmitter
	PublisherURL                     string   // 发布者地址, PublisherType=Redis 时必填
	PublisherConfig                  string   // 发布者配置信息, PublisherType=Redis 时为 Redis 密码,选填
	SessionLength                    int      // Session 有效期,单位为秒,取值大于 0 ,默认为 31536000 秒,即 1 年
	RevokeSessionOnPasswordReset     bool     // 密码重置后是否清除 Session ,默认为 true 清除 Session
	PreventLoginWithUnverifiedEmail  bool     // 是否阻止未验证邮箱的用户登录,默认为 false 不阻止
	CacheAdapter                     string   // 缓存模块,可选: LRU、InMemory、Redis、Null, 默认为 LRU 使用内存做缓存模块
	RedisAddress                     string   // Redis 地址, CacheAdapter=Redis 时必填
	RedisPassword                    string   // Redis 密码,选填
	SchemaCacheTTL                   int      // Schema 缓存有效期,单位为秒。取值: -1 表示永不过期,0 表示使用 CacheAdapter 自身的有效期,或者大于 0 ,默认为 5 秒
	CacheMaxSize                     int      // LRUCache最大长度
	EnableSingleSchemaCache          bool     // 是否允许缓存唯一一份 SchemaCache ,默认为 false 不允许
	WebhookKey                       string   // 用于云代码鉴权
	EnableAccountLockout             bool     // 是否启用账户锁定规则,默认为 false 不启用
	AccountLockoutThreshold          int      // 锁定账户需要的登录失败次数,取值范围: 1-999 ,默认为 3 次
	AccountLockoutDuration           int      // 锁定账户时长,单位为分钟,取值范围: 1-99999 ,默认为 10 分钟
	PasswordPolicy                   bool     // 是否启用密码规则,默认为 false 不启用
	ResetTokenValidityDuration       int      // 密码重置验证 Token 有效期,单位为秒,取值大于等于 0 ,默认为 0 表示不设置 Token 有效期
	ValidatorPattern                 string   // 校验密码规则的正则表达式
	DoNotAllowUsername               bool     // 是否启用密码中不允许包含用户名,默认为 false 不启用,密码中可包含用户名
	MaxPasswordAge                   int      // 密码的最长使用时间,单位为天,取值大于等于 0 ,默认为 0 表示不设置最长使用时间
	MaxPasswordHistory               int      // 最大密码历史个数,修改的密码不能与密码历史重复,取值范围: 0-20 ,默认为 0 表示不设置密码历史
	UserSensitiveFields              []string // 用户敏感字段,按需删除,多个字段使用 | 删除,如: email|password
	AnalyticsAdapter                 string   // 分析模块,可选:InfluxDB,默认使用空的分析模块
	InfluxDBURL                      string   // InfluxDB 地址,仅在 AnalyticsAdapter=InfluxDB 时需要配置
	InfluxDBUsername                 string   // InfluxDB 用户名,仅在 AnalyticsAdapter=InfluxDB 时需要配置
	InfluxDBPassword                 string   // InfluxDB 密码,仅在 AnalyticsAdapter=InfluxDB 时需要配置
	InfluxDBDatabaseName             string   // InfluxDB 数据库,仅在 AnalyticsAdapter=InfluxDB 时需要配置
	InvalidLink                      string   // 自定义页面地址,无效链接页面
	InvalidVerificationLink          string   // 自定义页面地址,无效验证链接页面
	LinkSendSuccess                  string   // 自定义页面地址,发送成功页面
	LinkSendFail                     string   // 自定义页面地址,发送失败页面
	VerifyEmailSuccess               string   // 自定义页面地址,验证邮箱成功页面
	ChoosePassword                   string   // 自定义页面地址,修改密码页面
	PasswordResetSuccess             string   // 自定义页面地址,密码重置成功页面
	ParseFrameURL                    string   // 自定义页面地址,用于呈现验证 Email 页面和密码重置页面
	FCMServerKey                     string   // FCM Server Key
	UMengAndroidAppKey               string   // 友盟推送 android app key
	UMengIOSAppKey                   string   // 友盟推送 ios app key
	UMengAndroidAppMasterSecret      string   // 友盟推送 android app master secret
	UMengIOSAppMasterSecret          string   // 友盟推送 ios app master secret
	HDFSNameNode                     string   // HDFS Name Node 地址
	HDFSUser                         string   // HDFS 用户名
	HDFSRoot                         string   // HDFS 存储根目录
	PgMaxConnections                 int      // Postgres Max Connections
}

Config ...

var (
	// TConfig ...
	TConfig *Config
)

Jump to

Keyboard shortcuts

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