mukan-ignite/ignite/pkg/env/env.go
Mukan Erkin Törük 26b204bd04
Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

45 lines
1,013 B
Go

package env
import (
"fmt"
"os"
"path"
"github.com/ignite/cli/v29/ignite/pkg/xfilepath"
)
const (
DebugEnvVar = "IGNT_DEBUG"
ConfigDirEnvVar = "IGNT_CONFIG_DIR"
)
// SetDebug sets the debug environment variable to "1".
// This is used to enable debug mode in the application.
func SetDebug() {
_ = os.Setenv(DebugEnvVar, "1")
}
// IsDebug checks if the debug environment variable is set to "1".
// This is used to determine if the application is running in debug mode.
func IsDebug() bool {
return os.Getenv(DebugEnvVar) == "1"
}
func ConfigDir() xfilepath.PathRetriever {
return func() (string, error) {
if dir := os.Getenv(ConfigDirEnvVar); dir != "" {
if !path.IsAbs(dir) {
panic(fmt.Sprintf("%s must be an absolute path", ConfigDirEnvVar))
}
return dir, nil
}
return xfilepath.JoinFromHome(xfilepath.Path(".ignite"))()
}
}
func SetConfigDir(dir string) {
err := os.Setenv(ConfigDirEnvVar, dir)
if err != nil {
panic(fmt.Sprintf("set config dir env: %v", err))
}
}