Files
picoclaw/pkg/config/envkeys.go
T
loveuer 6159157e47 refactor: remove WebUI and launcher
删除 WebUI/launcher、专属依赖、资源及桌面和 Android bundle 打包入口。
精简 Docker、CI/发布配置和多语言文档,保留 CLI、Gateway、Pico 与联网工具。
85 个包回归、vet/lint、文档检查及本机/Linux amd64 构建通过。
2026-11-11 14:07:20 +08:00

53 lines
1.4 KiB
Go

// PicoClaw - Ultra-lightweight personal AI agent
// License: MIT
//
// Copyright (c) 2026 PicoClaw contributors
package config
import (
"os"
"path/filepath"
"github.com/sipeed/picoclaw/pkg"
)
// Runtime environment variable keys for the picoclaw process.
// These control the location of files and binaries at runtime and are read
// directly via os.Getenv / os.LookupEnv. All picoclaw-specific keys use the
// PICOCLAW_ prefix. Reference these constants instead of inline string
// literals to keep all supported knobs visible in one place and to prevent
// typos.
const (
// EnvHome overrides the base directory for all picoclaw data
// (config, workspace, skills, auth store, …).
// Default: ~/.picoclaw
EnvHome = "PICOCLAW_HOME"
// EnvConfig overrides the full path to the JSON config file.
// Default: $PICOCLAW_HOME/config.json
EnvConfig = "PICOCLAW_CONFIG"
// EnvBuiltinSkills overrides the directory from which built-in
// skills are loaded.
// Default: <cwd>/skills
EnvBuiltinSkills = "PICOCLAW_BUILTIN_SKILLS"
// EnvGatewayHost overrides the host address for the gateway server.
// Default: "localhost"
EnvGatewayHost = "PICOCLAW_GATEWAY_HOST"
)
func GetHome() string {
homePath, _ := os.UserHomeDir()
if picoclawHome := os.Getenv(EnvHome); picoclawHome != "" {
homePath = picoclawHome
} else if homePath != "" {
homePath = filepath.Join(homePath, pkg.DefaultPicoClawHome)
}
if homePath == "" {
homePath = "."
}
return homePath
}