mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Simplify debugging runtime config object changes
This commit is contained in:
parent
c89b50bf31
commit
5042d49935
@ -175,9 +175,25 @@ const config_pointer = {};
|
||||
// We'd like to store values changed at runtime separately
|
||||
// for easier runtime debugging
|
||||
{
|
||||
const config_runtime_values = {};
|
||||
const config_runtime_values = {
|
||||
$: 'runtime-values'
|
||||
};
|
||||
config_runtime_values.__proto__ = config_to_export;
|
||||
config_to_export = config_runtime_values
|
||||
|
||||
// These can be difficult to find and cause painful
|
||||
// confusing issues, so we log any time this happens
|
||||
config_to_export = new Proxy(config_to_export, {
|
||||
set: (target, prop, value, receiver) => {
|
||||
console.log(
|
||||
'\x1B[36;1mCONFIGURATION MUTATED AT RUNTIME\x1B[0m',
|
||||
prop, 'to', value
|
||||
);
|
||||
// console.log(new Error('stack trace to find configuration mutation'));
|
||||
target[prop] = value;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = config_to_export;
|
||||
module.exports = config_to_export;
|
||||
|
Loading…
Reference in New Issue
Block a user