Files
iris-context/config/env.go
T
VERSE 3d76a3ee88 feat: toml config support (#9)
## What's new
- TOML config support 
- add config init command to justfile
https://github.com/versenilvis/IRIS/pull/9/commits/a5bb6c23d74ca73385b3590d2eb275ce6429906b
- add copy binary file to local bin on reload
https://github.com/versenilvis/IRIS/pull/9/commits/4da3acdbc58c28f20fa0021d15fec82823ba392b
- init config on setup
https://github.com/versenilvis/IRIS/pull/9/commits/fb48b6bb832f38e24fab9211d92858bab9a58a07

## Fix
- add lsof to support macos because /proc filesystem is Linux-specific
and does not exist on macOS 0439d829573864fcf902fc4127f7d45384bfab01
- git push doesnt suggest current branch, fix
https://github.com/versenilvis/IRIS/pull/9/commits/b498532b401b764a4a1a2c70b3cb44b7caf72320
- use timeout context for lsof command in reload handler
https://github.com/versenilvis/IRIS/pull/9/commits/1a2baee951e6538a729da12aedfe53960e51102d
2026-05-30 22:05:06 +07:00

50 lines
1.2 KiB
Go

package config
import (
"os"
"strconv"
"time"
)
func applyEnv(cfg *Config) {
if val := os.Getenv("IRIS_CORE_DEBUG"); val != "" {
if b, err := strconv.ParseBool(val); err == nil {
cfg.Core.Debug = b
}
}
if val := os.Getenv("IRIS_CORE_SHELL"); val != "" {
cfg.Core.Shell = val
}
if val := os.Getenv("IRIS_CORE_MODE"); val != "" {
cfg.Core.Mode = val
}
if val := os.Getenv("IRIS_UI_GHOST_TEXT"); val != "" {
if b, err := strconv.ParseBool(val); err == nil {
cfg.UI.GhostText = b
}
}
if val := os.Getenv("IRIS_UI_MAX_SUGGESTIONS"); val != "" {
if i, err := strconv.Atoi(val); err == nil {
cfg.UI.MaxSuggestions = i
}
}
if val := os.Getenv("IRIS_UI_MAX_HEIGHT"); val != "" {
if i, err := strconv.Atoi(val); err == nil {
cfg.UI.MaxHeight = i
}
}
if val := os.Getenv("IRIS_UPDATER_CHANNEL"); val != "" {
cfg.Updater.Channel = val
}
if val := os.Getenv("IRIS_UPDATER_INTERVAL"); val != "" {
if dur, err := time.ParseDuration(val); err == nil {
cfg.Updater.CheckInterval = Duration(dur)
}
}
if val := os.Getenv("IRIS_UPDATER_CHECK_ON_STARTUP"); val != "" {
if b, err := strconv.ParseBool(val); err == nil {
cfg.Updater.CheckOnStartup = b
}
}
}