Documentation ¶
Index ¶
- Constants
- Variables
- func Add[T any](name string, obj T)
- func Cfg() *config.Config
- func Cli() *gcli.App
- func Get[T any](name string) T
- func GetAny(name string) any
- func Ghub() *github.GitHub
- func Gitx() *gitx.Config
- func Glab() *gitlab.GitLab
- func Has(name string) bool
- func HasAliasMark(path string) bool
- func IsDebug() bool
- func Log() *slog.Logger
- func Lookup[T any](name string) (v T, ok bool)
- func Names() []string
- func Run()
- func Rux() *rux.Router
- func Set[T any](name string, obj T)
- type BootChecker
- type BootFunc
- type BootLoader
- type Config
- func (c *Config) CachePath(subPaths ...string) string
- func (c *Config) ConfFile() string
- func (c *Config) ConfigPath(subPaths ...string) string
- func (c *Config) DotenvFile() string
- func (c *Config) HasAliasMark(path string) bool
- func (c *Config) IsPathAlias(name string) bool
- func (c *Config) Path(subPaths ...string) string
- func (c *Config) PathBuild(subPaths ...string) string
- func (c *Config) PathByName(name string) string
- func (c *Config) PathResolve(path string) string
- func (c *Config) ResolvePath(path string) string
- func (c *Config) SetDotenvFile(dotenvFile string)
- func (c *Config) TmpPath(subPaths ...string) string
- type Info
- type KiteApp
- func (ka *KiteApp) AddBootFuncs(bfs ...BootFunc) *KiteApp
- func (ka *KiteApp) AddLoader(bl BootLoader) *KiteApp
- func (ka *KiteApp) AddLoaders(bls ...BootLoader) *KiteApp
- func (ka *KiteApp) AddPreLoader(bfs ...BootFunc) *KiteApp
- func (ka *KiteApp) Boot() error
- func (ka *KiteApp) InitPaths()
- func (ka *KiteApp) OnShutdown(fn func())
- func (ka *KiteApp) SetConfFile(file string)
- type StdLoader
Constants ¶
View Source
const ( EnvLocal = "local" EnvDev = "dev" EnvTest = "test" EnvPre = "pre" EnvProd = "prod" )
Env names
View Source
const ( ObjCli = "cli" ObjRux = "rux" ObjConf = "config" ObjLog = "logger" ObjPlugin = "plugin" ObjScript = "script" ObjGit = "git" ObjGlab = "gitlab" ObjGhub = "github" )
Variables ¶
View Source
var ( // PathMarkPrefixes allowed path name prefix mark. PathMarkPrefixes = []byte{'$', '#', '@'} OSPathSepChar = uint8(os.PathSeparator) OSPathSepStr = string(os.PathSeparator) )
some special chars
View Source
var ( // L kite logger L *slog.Logger // CL kite console logger CL *slog.Logger // SL server logger SL *slog.Logger )
View Source
var ( Lcp *lcproxy.LocalProxy Scripts *kscript.Runner Plugins *kiteext.PluginRunner QJump *quickjump.QuickJump // PathMap data PathMap *kiteext.PathMap OpenMap maputil.Aliases Vars *kiteext.VarMap HTpl *httptpl.Manager )
View Source
var (
KiteVerbose = sysutil.Getenv(appconst.EnvKiteVerbose, slog.WarnLevel.LowerName())
)
Functions ¶
func HasAliasMark ¶
HasAliasMark check path string, start one of PathMarkPrefixes
Types ¶
type BootChecker ¶
type BootChecker interface { // BeforeBoot check something before boot run BeforeBoot() bool }
BootChecker for app start boot.
type BootLoader ¶
BootLoader for app start boot.
type Config ¶
type Config struct { // BaseDir base data dir BaseDir string `json:"base_dir" default:"${KITE_BASE_DIR}"` // TmpDir tmp dir TmpDir string `json:"tmp_dir"` // DataDir tmp dir DataDir string `json:"data_dir"` // CacheDir cache dir CacheDir string `json:"cache_dir"` // ConfigDir config dir ConfigDir string `json:"config_dir"` // ResourceDir resource dir ResourceDir string `json:"resource_dir"` // IncludeConfig include config files. // default file path relative the config_dir IncludeConfig []string `json:"include_config"` // contains filtered or unexported fields }
Config struct of app
Gen by:
kite go gen st -s @c -t json --name Conf
func (*Config) ConfigPath ¶
ConfigPath build and get full path relative the config dir.
func (*Config) HasAliasMark ¶
HasAliasMark check has alias mark
func (*Config) IsPathAlias ¶
IsPathAlias check is path alias name, without prefix char.
func (*Config) PathByName ¶
PathByName get path by alias name
func (*Config) PathResolve ¶
PathResolve resolve path alias. "$base/tmp" => "path/to/base_dir/tmp"
func (*Config) ResolvePath ¶
ResolvePath alias name.
type Info ¶
type Info struct { Branch string Version string Revision string GoVersion string BuildDate string PublishAt string UpdatedAt string }
Info for kite app
type KiteApp ¶
type KiteApp struct { *Info *Config *gcli.Context // AfterPreFn hook on after app pre-bootloaders booted AfterPreFn func(ka *KiteApp) error // contains filtered or unexported fields }
KiteApp kite app container
func (*KiteApp) AddBootFuncs ¶
AddBootFuncs to app
func (*KiteApp) AddLoaders ¶
func (ka *KiteApp) AddLoaders(bls ...BootLoader) *KiteApp
AddLoaders to app
func (*KiteApp) AddPreLoader ¶
AddPreLoader to app
Click to show internal directories.
Click to hide internal directories.