Skip to content

Refactor rest port setting#372

Merged
from2001 merged 3 commits intodevelopfrom
refactor/rest-port-setting
Mar 14, 2026
Merged

Refactor rest port setting#372
from2001 merged 3 commits intodevelopfrom
refactor/rest-port-setting

Conversation

@from2001
Copy link
Collaborator

This pull request adds support for configuring the REST API bridge port (rest_api_port) throughout the STYLY-NetSync-Server. The new port can now be set via configuration files, command-line arguments, and is validated and used consistently in the server startup logic. Additionally, the command-line interface is reorganized for better usability, grouping related options together.

REST API Port Configuration:

  • Added a new rest_api_port field to the ServerConfig class and included it in the list of configurable and validated ports. [1] [2] [3]
  • Updated the default configuration file (default.toml) to include a default value for rest_api_port.
  • Modified the server startup logic to use the configured rest_api_port instead of a hardcoded or environment variable value.
  • Added support for setting rest_api_port via a new --rest-api-port command-line argument, and ensured it is merged into the configuration. [1] [2]

Command-line Interface Improvements:

  • Grouped port-related and logging-related command-line arguments for better organization and usability.

Testing:

  • Updated tests to include rest_api_port in custom configuration scenarios.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class configuration support for the REST API bridge port (rest_api_port) so the REST bridge port is no longer hardcoded and can be controlled consistently via default config, user config, and CLI overrides.

Changes:

  • Introduces rest_api_port into ServerConfig, validation, default TOML, and CLI merging.
  • Updates server startup to bind the REST bridge using the configured rest_api_port (instead of an environment variable).
  • Reorganizes CLI options into clearer argument groups (ports, logging) and keeps --version available.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
STYLY-NetSync-Server/src/styly_netsync/config.py Adds rest_api_port to config schema, valid keys, port validation, and CLI override merging.
STYLY-NetSync-Server/src/styly_netsync/default.toml Defines default rest_api_port = 8800.
STYLY-NetSync-Server/src/styly_netsync/server.py Uses configured rest_api_port for REST bridge startup and reorganizes CLI flags into groups.
STYLY-NetSync-Server/tests/test_config.py Updates custom ServerConfig construction to include rest_api_port.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@from2001 from2001 merged commit 916aea2 into develop Mar 14, 2026
@from2001 from2001 deleted the refactor/rest-port-setting branch March 14, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants