415bf0cce1
Single Go binary for the ClickHouse log store (logs.raw): chlog with cat/tail/grep subcommands, plus chcat/chtail/chgrep argv[0]-dispatched symlink entrypoints. Every query is time-bounded and fully parameterized; chgrep guards wide unfiltered scans. Ships nfpm RPM with completions and woodpecker PR/tag pipelines mirroring node-lookup.
30 lines
475 B
Go
30 lines
475 B
Go
package chlog
|
|
|
|
import "os"
|
|
|
|
const (
|
|
DefaultURL = "http://clickhouse-logs.logging.svc.cluster.local:8123"
|
|
DefaultUser = "logreader"
|
|
)
|
|
|
|
type Config struct {
|
|
URL string
|
|
User string
|
|
Password string
|
|
}
|
|
|
|
func ConfigFromEnv() Config {
|
|
cfg := Config{
|
|
URL: os.Getenv("CH_URL"),
|
|
User: os.Getenv("CH_USER"),
|
|
Password: os.Getenv("CH_PASSWORD"),
|
|
}
|
|
if cfg.URL == "" {
|
|
cfg.URL = DefaultURL
|
|
}
|
|
if cfg.User == "" {
|
|
cfg.User = DefaultUser
|
|
}
|
|
return cfg
|
|
}
|