1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-13 12:35:48 +03:00
mobile-nixos/boot/lib/init/configuration.rb
Samuel Dionne-Riel 2410994f17 boot/lib: Be a bit more resilient outside of stage-1
Mainly allows using the simulator with the error applet
2021-07-15 18:16:47 -04:00

13 lines
298 B
Ruby

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