1- import os
2- import collections
3- import yaml
4- import logging
5-
6- from pathlib import Path
7- from schema import Schema , And , Or , Use , Optional
1+ from schema import And , Or , Use , Optional
82
93from vantage6 .common .configuration_manager import (
104 Configuration ,
115 ConfigurationManager
126)
137
8+
149class ServerConfiguration (Configuration ):
1510
1611 VALIDATORS = {
@@ -21,7 +16,8 @@ class ServerConfiguration(Configuration):
2116 "uri" : Use (str ),
2217 "allow_drop_all" : Use (bool ),
2318 "logging" : {
24- "level" : And (Use (str ), lambda l : l in ("DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" )),
19+ "level" : And (Use (str ), lambda l : l in ("DEBUG" , "INFO" , "WARNING" ,
20+ "ERROR" , "CRITICAL" )),
2521 "file" : Use (str ),
2622 "use_console" : Use (bool ),
2723 "backup_count" : And (Use (int ), lambda n : n > 0 ),
@@ -31,6 +27,7 @@ class ServerConfiguration(Configuration):
3127 }
3228 }
3329
30+
3431class NodeConfiguration (Configuration ):
3532
3633 VALIDATORS = {
@@ -41,7 +38,8 @@ class NodeConfiguration(Configuration):
4138 "databases" : {Use (str ): Use (str )},
4239 "api_path" : Use (str ),
4340 "logging" : {
44- "level" : And (Use (str ), lambda l : l in ("DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" )),
41+ "level" : And (Use (str ), lambda l : l in ("DEBUG" , "INFO" , "WARNING" ,
42+ "ERROR" , "CRITICAL" )),
4543 "file" : Use (str ),
4644 "use_console" : Use (bool ),
4745 "backup_count" : And (Use (int ), lambda n : n > 0 ),
@@ -55,12 +53,15 @@ class NodeConfiguration(Configuration):
5553 }
5654 }
5755
56+
5857class TestConfiguration (Configuration ):
5958
6059 VALIDATORS = {
6160 # "api_key": And(Use(str), len),
6261 # "logging": {
63- # "level": And(Use(str), lambda l: l in ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NONE")),
62+ # "level": And(Use(str), lambda l: l in ("DEBUG", "INFO",
63+ # "WARNING", "ERROR",
64+ # "CRITICAL", "NONE")),
6465 # "file": Use(str),
6566 # "use_console": Use(bool),
6667 # "backup_count": And(Use(int), lambda n: n > 0),
@@ -71,7 +72,6 @@ class TestConfiguration(Configuration):
7172 }
7273
7374
74-
7575class NodeConfigurationManager (ConfigurationManager ):
7676
7777 def __init__ (self , name , * args , ** kwargs ):
@@ -81,6 +81,7 @@ def __init__(self, name, *args, **kwargs):
8181 def from_file (cls , path ):
8282 return super ().from_file (path , conf_class = NodeConfiguration )
8383
84+
8485class ServerConfigurationManager (ConfigurationManager ):
8586
8687 def __init__ (self , name , * args , ** kwargs ):
0 commit comments