1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 16:28:11 +00:00

Fix command line issue with certfile and certkey

This commit is contained in:
grossmj 2023-08-11 18:34:16 +10:00
parent 66dd8bdadb
commit cefa459721
2 changed files with 6 additions and 9 deletions

View File

@ -146,7 +146,6 @@ class ServerSettings(BaseModel):
enable_builtin_templates: bool = True
model_config = ConfigDict(validate_assignment=True, str_strip_whitespace=True, use_enum_values=True)
@field_validator("additional_images_paths", mode="before")
@classmethod
def split_additional_images_paths(cls, v):
@ -154,7 +153,6 @@ class ServerSettings(BaseModel):
return v.split(";")
return list()
@field_validator("allowed_interfaces", mode="before")
@classmethod
def split_allowed_interfaces(cls, v):
@ -162,27 +160,24 @@ class ServerSettings(BaseModel):
return v.split(",")
return list()
@model_validator(mode="after")
def check_console_port_range(self) -> "ServerSettings":
if self.console_end_port_range <= self.console_start_port_range:
raise ValueError("console_end_port_range must be > console_start_port_range")
return self
@model_validator(mode="after")
def check_vnc_port_range(self) -> "ServerSettings":
if self.vnc_console_end_port_range <= self.vnc_console_start_port_range:
raise ValueError("vnc_console_end_port_range must be > vnc_console_start_port_range")
return self
@model_validator(mode="after")
def check_enable_ssl(self) -> "ServerSettings":
if self.enable_ssl is True:
if self.certfile is None:
if not self.certfile:
raise ValueError("SSL is enabled but certfile is not configured")
if self.certkey is None:
if not self.certkey:
raise ValueError("SSL is enabled but certkey is not configured")
return self

View File

@ -167,8 +167,10 @@ class Server:
config.Server.allow_remote_console = args.allow
config.Server.host = args.host
config.Server.port = args.port
config.Server.certfile = args.certfile
config.Server.certkey = args.certkey
if args.certfile:
config.Server.certfile = args.certfile
if args.certkey:
config.Server.certkey = args.certkey
config.Server.enable_ssl = args.ssl
def _signal_handling(self):