mirror of
https://github.com/daylinmorgan/tsm.git
synced 2024-12-22 05:00:44 -06:00
feat: add env var for config file path
This commit is contained in:
parent
16522d0b07
commit
863391ce3c
1 changed files with 2 additions and 4 deletions
|
@ -1,8 +1,6 @@
|
||||||
import std/[os, sequtils, tables, strutils]
|
import std/[os, tables, strutils]
|
||||||
import usu
|
import usu
|
||||||
|
|
||||||
import term
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TsmConfig* = object
|
TsmConfig* = object
|
||||||
dirs*: seq[string]
|
dirs*: seq[string]
|
||||||
|
@ -13,7 +11,7 @@ type
|
||||||
|
|
||||||
# TODO: update when the API for usu is complete
|
# TODO: update when the API for usu is complete
|
||||||
proc loadConfigFile(): TsmConfig =
|
proc loadConfigFile(): TsmConfig =
|
||||||
let configPath = getConfigDir() / "tsm" / "config.usu"
|
let configPath = getEnv("TSM_CONFIG", getConfigDir() / "tsm" / "config.usu")
|
||||||
if fileExists configPath:
|
if fileExists configPath:
|
||||||
let usuNode = parseUsu(readFile configPath)
|
let usuNode = parseUsu(readFile configPath)
|
||||||
let topFields = usuNode.fields
|
let topFields = usuNode.fields
|
||||||
|
|
Loading…
Reference in a new issue