mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/librenms: seed database in module, not only in test
To properly use librenms and create a user, you need the seeded roles like admin.
This commit is contained in:
parent
8f797af34d
commit
314cfdddb5
2 changed files with 6 additions and 3 deletions
|
@ -596,7 +596,9 @@ in
|
|||
${pkgs.envsubst}/bin/envsubst -i ${configJson} -o ${cfg.dataDir}/config.json
|
||||
export PHPRC=${phpIni}
|
||||
|
||||
INIT=false
|
||||
if [[ ! -s ${cfg.dataDir}/.env ]]; then
|
||||
INIT=true
|
||||
# init .env file
|
||||
echo "APP_KEY=" > ${cfg.dataDir}/.env
|
||||
${artisanWrapper}/bin/librenms-artisan key:generate --ansi
|
||||
|
@ -655,6 +657,10 @@ in
|
|||
echo "${package.version}" > ${cfg.dataDir}/version
|
||||
fi
|
||||
|
||||
if [[ $INIT == "true" ]]; then
|
||||
${artisanWrapper}/bin/librenms-artisan db:seed --force --no-interaction
|
||||
fi
|
||||
|
||||
# regenerate cache if package has changed
|
||||
if [[ $OLD_PACKAGE != "${package}" ]]; then
|
||||
${artisanWrapper}/bin/librenms-artisan view:clear
|
||||
|
|
|
@ -50,9 +50,6 @@ in
|
|||
API_USER_NAME=api
|
||||
API_TOKEN=${api_token} # random md5 hash
|
||||
|
||||
# seeding database to get the admin roles
|
||||
${pkgs.librenms}/artisan db:seed --force --no-interaction
|
||||
|
||||
# we don't need to know the password, it just has to exist
|
||||
API_USER_PASS=$(${pkgs.pwgen}/bin/pwgen -s 64 1)
|
||||
${pkgs.librenms}/artisan user:add $API_USER_NAME -r admin -p $API_USER_PASS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue