summaryrefslogtreecommitdiff
path: root/script/config/env.lua
blob: 163ee40421a900f9fc9c5f6e6883e116084200b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
-- Handles loading environment arguments

---ENV args are defined here.
---- `name` is the ENV arg name
---- `key` is the value used to index `_G` for setting the argument
---@type { name: string, key: string }[]
local vars = {
    {
        name = "LLS_CHECK_LEVEL",
        key = "CHECKLEVEL",
    },
    {
        name = "LLS_CHECK_PATH",
        key = "CHECK",
    },
    {
        name = "LLS_CONFIG_PATH",
        key = "CONFIGPATH"
    },
    {
        name = "LLS_DOC_OUT_PATH",
        key = "DOC_OUT_PATH",
    },
    {
        name = "LLS_DOC_PATH",
        key = "DOC",
    },
    {
        name = "LLS_FORCE_ACCEPT_WORKSPACE",
        key = "FORCE_ACCEPT_WORKSPACE"
    },
    {
        name = "LLS_LOCALE",
        key = "LOCALE",
    },
    {
        name = "LLS_LOG_LEVEL",
        key = "LOGLEVEL",
    },
    {
        name = "LLS_LOG_PATH",
        key = "LOGPATH",
    },
    {
        name = "LLS_META_PATH",
        key = "METAPATH"
    }
}

for _, var in ipairs(vars) do
    local value = os.getenv(var.name)
    if value then
        _G[var.key] = value
    end
end