From 6d8fcee025d80a38bd287933143353669e2d23fc Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 27 Jan 2022 19:57:06 -0800 Subject: [PATCH] WIP: Custom unmarshal? --- config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config.go b/config.go index e97183c..4e14e7e 100644 --- a/config.go +++ b/config.go @@ -13,6 +13,21 @@ type Config struct { Rules []BrowserRuleConfig } +func (r *BrowserRule) UnmarshalJSON(data []byte) error { + var values struct { + command string + args []string + matchHostname []string + matchHostRegexp []string + matchRegexp []string + } + if err := json.Unmarshal(data, &values); err != nil { + return err + } + + return nil +} + // BrowserRuleConfig represents a BrowserRule type BrowserRuleConfig struct { BrowserCommand []string