From a77651a2d7fb8ba6b512d3c51e4e520a0697f3e8 Mon Sep 17 00:00:00 2001 From: checktheroads Date: Fri, 23 Aug 2019 15:53:31 -0700 Subject: [PATCH] validate title_mode [skip ci] --- hyperglass/configuration/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hyperglass/configuration/models.py b/hyperglass/configuration/models.py index ceefe3b..6f10151 100644 --- a/hyperglass/configuration/models.py +++ b/hyperglass/configuration/models.py @@ -325,6 +325,14 @@ class Branding(BaseSettings): error500: Error500 = Error500() error504: Error504 = Error504() + @validator("title_mode") + def check_title_mode(cls, v): + """Verifies title_mode matches supported values""" + supported_modes = ["logo_only", "text_only", "logo_title", "all"] + if v not in supported_modes: + raise ValueError("title_mode must be one of {}".format(supported_modes)) + return v + credit: Credit = Credit() footer: Footer = Footer() text: Text = Text()