feat: add env var for config file path

This commit is contained in:
Daylin Morgan 2024-03-20 12:17:18 -05:00
parent 16522d0b07
commit 863391ce3c
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -1,8 +1,6 @@
import std/[os, sequtils, tables, strutils]
import std/[os, tables, strutils]
import usu
import term
type
TsmConfig* = object
dirs*: seq[string]
@ -13,7 +11,7 @@ type
# TODO: update when the API for usu is complete
proc loadConfigFile(): TsmConfig =
let configPath = getConfigDir() / "tsm" / "config.usu"
let configPath = getEnv("TSM_CONFIG", getConfigDir() / "tsm" / "config.usu")
if fileExists configPath:
let usuNode = parseUsu(readFile configPath)
let topFields = usuNode.fields