summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-22 21:51:29 +0200
committerewy <ewy0@protonmail.com>2026-04-22 21:51:29 +0200
commitd88661935fa2b6e2c0fe93345800113e1a71b451 (patch)
tree0002f1152a4eebafee6e3dea4065964a50d786c0 /env
parentdeebd135ffcb1c167f12ecf2d4c0aebdc14cbc86 (diff)
docs
Diffstat (limited to 'env')
-rw-r--r--env/env.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/env/env.go b/env/env.go
index 2a76e33..f1bd9d8 100644
--- a/env/env.go
+++ b/env/env.go
@@ -12,6 +12,8 @@ import (
"slices"
)
+// IsEnv returns whether a given file is suitable for environment loading
+// this method respects the --env flag
func IsEnv(file string) bool {
options := []string{
".env",
@@ -26,6 +28,7 @@ func IsEnv(file string) bool {
return slices.Contains(options, file)
}
+// Files returns a list of files (that exist) that should be indexed and used as environment files
func Files(f fs.FS, p string, deep bool) []string {
var result []string
dir, err := fs.ReadDir(f, p)
@@ -43,6 +46,7 @@ func Files(f fs.FS, p string, deep bool) []string {
return result
}
+// Get returns all environment key-value pairs we should index for a source
func Get(src *model.Source) []string {
f := os.DirFS(src.Path)
var result []string