Documentation ¶
Index ¶
- Constants
- func BeginningOfWakatime() time.Time
- func ChooseFS(localDir string, embeddedFS fs.FS) fs.FS
- func CloseQueues()
- func EventBus() *hub.Hub
- func GetDefaultQueue() *artifex.Dispatcher
- func GetQueue(name string) *artifex.Dispatcher
- func GetSessionStore() *sessions.CookieStore
- func InitLogger(isDev bool)
- func InitQueue(name string, workers int) error
- func IsDev(env string) bool
- func Set(config *Config)
- func StartJobs()
- type ApplicationEvent
- type Config
- type JobQueueMetrics
- type SMTPMailConfig
- type SentryLogger
- type WakapiDBOpts
Constants ¶
View Source
const ( DefaultConfigPath = "config.yml" SQLDialectMysql = "mysql" SQLDialectPostgres = "postgres" SQLDialectSqlite = "sqlite3" SQLDialectMssql = "mssql" KeyLatestTotalTime = "latest_total_time" KeyLatestTotalUsers = "latest_total_users" KeyLastImport = "last_import" // import attempt KeyLastImportSuccess = "last_successful_import" // last actual successful import KeyFirstHeartbeat = "first_heartbeat" KeySubscriptionNotificationSent = "sub_reminder" KeyNewsbox = "newsbox" KeyInviteCode = "invite" SessionKeyDefault = "default" SimpleDateFormat = "2006-01-02" SimpleDateTimeFormat = "2006-01-02 15:04:05" ErrBadRequest = "400 bad request" ErrNotFound = "404 not found" ErrInternalServerError = "500 internal server error" )
View Source
const ( WakatimeApiUrl = "https://api.wakatime.com/api/v1" WakatimeApiUserUrl = "/users/current" WakatimeApiAllTimeUrl = "/users/current/all_time_since_today" WakatimeApiHeartbeatsUrl = "/users/current/heartbeats" WakatimeApiHeartbeatsBulkUrl = "/users/current/heartbeats.bulk" WakatimeApiUserAgentsUrl = "/users/current/user_agents" WakatimeApiMachineNamesUrl = "/users/current/machine_names" WakatimeApiDataDumpUrl = "/users/current/data_dumps" )
View Source
const ( TopicUser = "user.*" TopicHeartbeat = "heartbeat.*" TopicProjectLabel = "project_label.*" EventUserUpdate = "user.update" EventUserDelete = "user.delete" EventHeartbeatCreate = "heartbeat.create" EventProjectLabelCreate = "project_label.create" EventProjectLabelDelete = "project_label.delete" EventWakatimeFailure = "wakatime.failure" FieldPayload = "payload" FieldUser = "user" FieldUserId = "user.id" )
View Source
const ( QueueDefault = "wakapi.default" QueueProcessing = "wakapi.processing" QueueReports = "wakapi.reports" QueueMails = "wakapi.mail" QueueImports = "wakapi.imports" QueueHousekeeping = "wakapi.housekeeping" )
View Source
const ( IndexTemplate = "index.tpl.html" LoginTemplate = "login.tpl.html" ImprintTemplate = "imprint.tpl.html" SignupTemplate = "signup.tpl.html" SetPasswordTemplate = "set-password.tpl.html" ResetPasswordTemplate = "reset-password.tpl.html" SettingsTemplate = "settings.tpl.html" SummaryTemplate = "summary.tpl.html" LeaderboardTemplate = "leaderboard.tpl.html" ProjectsTemplate = "projects.tpl.html" )
View Source
const (
MailProviderSmtp = "smtp"
)
Variables ¶
This section is empty.
Functions ¶
func BeginningOfWakatime ¶
func ChooseFS ¶
ChooseFS returns a local (DirFS) file system when on 'dev' environment and the given go-embed file system otherwise
func CloseQueues ¶
func CloseQueues()
func GetDefaultQueue ¶
func GetDefaultQueue() *artifex.Dispatcher
func GetSessionStore ¶
func GetSessionStore() *sessions.CookieStore
func InitLogger ¶
func InitLogger(isDev bool)
Types ¶
type ApplicationEvent ¶
type ApplicationEvent struct { Type string Payload interface{} }
type Config ¶
type Config struct { Env string `default:"dev" env:"ENVIRONMENT"` Version string `yaml:"-"` QuickStart bool `yaml:"quick_start" env:"WAKAPI_QUICK_START"` SkipMigrations bool `yaml:"skip_migrations" env:"WAKAPI_SKIP_MIGRATIONS"` InstanceId string `yaml:"-"` // only temporary, changes between runs EnablePprof bool `yaml:"enable_pprof" env:"WAKAPI_ENABLE_PPROF"` App appConfig Security securityConfig Db dbConfig Server serverConfig Subscriptions subscriptionsConfig Sentry sentryConfig Mail mailConfig }
type JobQueueMetrics ¶
func GetQueueMetrics ¶
func GetQueueMetrics() []*JobQueueMetrics
type SMTPMailConfig ¶
type SMTPMailConfig struct { Host string `env:"WAKAPI_MAIL_SMTP_HOST"` Port uint `env:"WAKAPI_MAIL_SMTP_PORT"` Username string `env:"WAKAPI_MAIL_SMTP_USER"` Password string `env:"WAKAPI_MAIL_SMTP_PASS"` TLS bool `env:"WAKAPI_MAIL_SMTP_TLS"` SkipVerify bool `env:"WAKAPI_MAIL_SMTP_SKIP_VERIFY"` }
func (*SMTPMailConfig) ConnStr ¶
func (c *SMTPMailConfig) ConnStr() string
type SentryLogger ¶
SentryLogger wraps slog.Logger and provides a Fatal method
func Log ¶
func Log() *SentryLogger
func (*SentryLogger) Fatal ¶
func (l *SentryLogger) Fatal(msg string, args ...any)
type WakapiDBOpts ¶
type WakapiDBOpts struct {
// contains filtered or unexported fields
}
func GetWakapiDBOpts ¶
func GetWakapiDBOpts(dbConfig *dbConfig) *WakapiDBOpts
func (WakapiDBOpts) AfterInitialize ¶
func (opts WakapiDBOpts) AfterInitialize(db *gorm.DB) error
Click to show internal directories.
Click to hide internal directories.