Merge pull request #4041 from cole-h/enum-stringify

Serialize SandboxMode enum to string for JSON
This commit is contained in:
Eelco Dolstra 2020-09-22 11:08:56 +02:00 committed by GitHub
commit 7dd8baafe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,6 +147,12 @@ bool Settings::isWSL1()
const string nixVersion = PACKAGE_VERSION;
NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
{SandboxMode::smEnabled, true},
{SandboxMode::smRelaxed, "relaxed"},
{SandboxMode::smDisabled, false},
});
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
{
if (str == "true") value = smEnabled;