From f8af758814dadbcd1a49a97d055f33349e3aa926 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Thu, 4 May 2023 17:56:46 -0700 Subject: [PATCH] Add unsafe options to config --- internal/types/config.go | 5 +++++ main.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/types/config.go b/internal/types/config.go index caeff90..cba9f3b 100644 --- a/internal/types/config.go +++ b/internal/types/config.go @@ -24,6 +24,7 @@ type Config struct { PagerStyle string `toml:"pagerStyle"` IgnorePkgUpdates []string `toml:"ignorePkgUpdates"` Repos []Repo `toml:"repo"` + Unsafe Unsafe `toml:"unsafe"` } // Repo represents a LURE repo within a configuration file @@ -31,3 +32,7 @@ type Repo struct { Name string `toml:"name"` URL string `toml:"url"` } + +type Unsafe struct { + AllowRunAsRoot bool `toml:"allowRunAsRoot"` +} diff --git a/main.go b/main.go index 1ec22b7..365e0f9 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,7 @@ func init() { } func main() { - if os.Geteuid() == 0 { + if !cfg.Unsafe.AllowRunAsRoot && os.Geteuid() == 0 { log.Fatal("Running LURE as root is forbidden as it may cause catastrophic damage to your system").Send() }