1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-09-11 12:05:26 +03:00

boot/lib: Be a bit more resilient outside of stage-1

Mainly allows using the simulator with the error applet
This commit is contained in:
Samuel Dionne-Riel 2021-06-13 17:29:04 -04:00
parent 29e2940ca2
commit 2410994f17

View File

@ -1,7 +1,12 @@
# Handles lazy-loading the configuration, and giving a value for a given key.
module Configuration
def self.[](key)
@configuration ||= JSON.parse(File.read("/etc/boot/config"));
@configuration ||=
if File.exist?("/etc/boot/config")
JSON.parse(File.read("/etc/boot/config"))
else
{}
end
@configuration[key]
end
end