#!/bin/env fish
function isConfigured -S
    set -q "$CONFIG_MODULE"
end

function getConfig -S -a property
    source "$(status dirname)/eval-module.fish"
    evalModule "$CONFIG_MODULE" "$property" $argv[2..]
end

function getUsers -S
    getConfig valhalla.users --apply "builtins.attrNames" --json
end

function isSet -S -a property
    not test "$(getConfig "$property" --json)" = "null"
end

function collectionActive -S -a name
    [ "$(getConfig "valhalla.software.$name" --json)" = "true" ]
end