Skip to content

Commit 5f6ec1b

Browse files
committed
CHANGES:
- Rolled back default ports in schema validation.
1 parent e995482 commit 5f6ec1b

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

core/utils/validators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
__all__ = [
3232
"file_exists",
3333
"dir_exists",
34+
"obsolete",
35+
"unique_port",
36+
"any_of",
3437
"seq_or_map",
3538
"bool_or_map",
3639
"str_or_map",
@@ -139,7 +142,7 @@ def obsolete(value, rule, path):
139142
logger.warning(f'"{os.path.basename(path)}" is obsolete and will be set by the bot: Path "{path}"')
140143
return True
141144

142-
def unique_port(value, rule, path):
145+
def unique_port(value, _, path):
143146
try:
144147
value = int(value)
145148
if value < 1024 or value > 65535:

extensions/grpc/schemas/grpc_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ schema;grpc_schema:
44
allowempty: true # we might want to specify additional parameters
55
mapping:
66
enabled: {type: bool, nullable: false}
7-
port: {type: int, nullable: false, default: 50051, func: unique_port}
7+
port: {type: int, nullable: false, func: unique_port}
88
evalEnabled: {type: bool, nullable: false}
99
host: {type: str, nullable: false, range: {min: 1}}
1010
debug: {type: bool, nullable: false}

extensions/lotatc/schemas/lotatc_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ schema;instance_lotatc_schema:
2626
mapping:
2727
enabled: {type: bool, nullable: false}
2828
host: {type: str, nullable: false, range: {min: 1}}
29-
port: {type: int, nullable: false, default: 10310, func: unique_port}
29+
port: {type: int, nullable: false, func: unique_port}
3030
show_passwords: {type: bool, nullable: false}
3131
autoupdate: {type: bool, nullable: false}
3232
dedicated_mode: {type: bool, nullable: false, func: obsolete}

extensions/olympus/extension.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
class Olympus(Extension):
3131
_server_ports: dict[int, str] = dict()
3232
_client_ports: dict[int, str] = dict()
33+
_ws_ports: dict[int, str] = dict()
3334

3435
CONFIG_DICT = {
3536
"backend_port": {
@@ -161,7 +162,8 @@ async def prepare_olympus_json(self) -> bool:
161162
self.log.warning(
162163
f" => {self.server.name}: No write permission on olympus.json, skipping {self.name}.")
163164
return False
164-
server_port = self.config.get(self.backend_tag, {}).get('port', 3001)
165+
# Port checks
166+
server_port = self.config.get(self.backend_tag, {}).get('port', 4512)
165167
if type(self)._server_ports.get(server_port, self.server.name) != self.server.name:
166168
self.log.error(f" => {self.server.name}: {self.name} server.port {server_port} already in use by "
167169
f"server {type(self)._server_ports[server_port]}!")
@@ -173,6 +175,12 @@ async def prepare_olympus_json(self) -> bool:
173175
f"server {type(self)._client_ports[client_port]}!")
174176
return False
175177
type(self)._client_ports[client_port] = self.server.name
178+
ws_port = self.config.get('audio', {}).get('WSPort', 4000)
179+
if type(self)._ws_ports.get(client_port, self.server.name) != self.server.name:
180+
self.log.error(f" => {self.server.name}: {self.name} audio.WSPort {ws_port} already in use by "
181+
f"server {type(self)._ws_ports[ws_port]}!")
182+
return False
183+
type(self)._ws_ports[ws_port] = self.server.name
176184

177185
self.locals = self.load_config()
178186
default_address = '*' if self.version == '1.0.3.0' else 'localhost'

extensions/olympus/schemas/olympus_schema.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ schema;instance_olympus_schema:
3030
allowempty: true
3131
mapping:
3232
address: {type: str, nullable: false, range: {min: 1}}
33-
port: {type: int, required: true, nullable: false, default: 4512, func: unique_port}
33+
port: {type: int, required: true, nullable: false, func: unique_port}
3434
authentication:
3535
type: map
3636
nullable: false
@@ -47,7 +47,7 @@ schema;instance_olympus_schema:
4747
allowempty: true
4848
mapping:
4949
path: {type: str, nullable: false, range: {min: 1}, func: dir_exists}
50-
port: {type: int, required: true, nullable: false, default: 3000, func: unique_port}
50+
port: {type: int, required: true, nullable: false, func: unique_port}
5151
customAuthHeaders:
5252
type: map
5353
nullable: false
@@ -87,5 +87,5 @@ schema;instance_olympus_schema:
8787
required: true
8888
mapping:
8989
SRSPort: {type: int, nullable: false, func: obsolete}
90-
WSPort: {required: true, type: int, nullable: false, default: 4000, func: unique_port}
90+
WSPort: {required: true, type: int, nullable: false, func: unique_port}
9191
WSEndpoint: {type: str, nullable: false, range: {min: 1}}

extensions/srs/schemas/srs_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ schema;instance_srs_schema:
4242
enabled: {type: bool, nullable: false}
4343
config: {type: str, required: true, nullable: false}
4444
host: {type: str, nullable: false, range: {min: 1}}
45-
port: {type: int, nullable: false, default: 5002, func: unique_port}
45+
port: {type: int, nullable: false, func: unique_port}
4646
gui_server: {type: bool, nullable: false}
4747
minimized: {type: bool, nullable: false}
4848
debug: {type: bool, nullable: false}

extensions/tacview/schemas/tacview_schema.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ schema;instance_tacview_schema:
2222
tacviewMultiplayerFlightsAsClient: {type: int, nullable: false}
2323
tacviewMultiplayerFlightsAsHost: {type: int, nullable: false}
2424
tacviewRealTimeTelemetryEnabled: {type: bool,nullable: false}
25-
tacviewRealTimeTelemetryPort: {type: int, nullable: false, default: 42674, func: unique_port}
25+
tacviewRealTimeTelemetryPort: {type: int, nullable: false, func: unique_port}
2626
tacviewRealTimeTelemetryPassword: {type: str, nullable: false}
2727
tacviewRemoteControlEnabled: {type: bool, nullable: false}
28-
tacviewRemoteControlPort: {type: int, nullable: false, default: 42675, func: unique_port}
28+
tacviewRemoteControlPort: {type: int, nullable: false, func: unique_port}
2929
tacviewRemoteControlPassword: {type: str, nullable: false}
3030
tacviewSinglePlayerFlights: {type: int, nullable: false}
3131
tacviewTerrainExport: {type: int, nullable: false}

schemas/nodes_schema.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ mapping:
7676
missions_dir: {type: str, nullable: false, range: {min: 1}, func: dir_exists}
7777
mission_rewrite: {type: bool, nullable: false}
7878
autoscan: {type: bool, nullable: false}
79-
bot_port: {type: int, required: true, nullable: false, default: 6666, func: unique_port}
80-
webgui_port: {type: int, nullable: false, default: 8088, func: unique_port}
81-
dcs_port: {type: int, nullable: false, default: 10308, func: unique_port}
79+
bot_port: {type: int, required: true, nullable: false, func: unique_port}
80+
webgui_port: {type: int, nullable: false, func: unique_port}
81+
dcs_port: {type: int, nullable: false, func: unique_port}
8282
server_user: {type: str, nullable: false, range: {min: 1}}
8383
max_hung_minutes: {type: int, range: {min: 0}, nullable: false}
8484
affinity: {type: any, nullable: false, func: int_csv_or_list}

0 commit comments

Comments
 (0)