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:
parent
29e2940ca2
commit
2410994f17
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user