1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Add config option to change the server name. Ref #2149

This commit is contained in:
grossmj 2022-12-27 10:05:13 +08:00
parent 91b50eb5f2
commit 3e29ae4276
3 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,9 @@ default_admin_password = admin
[Server]
; Server name, default is what is returned by socket.gethostname()
name = GNS3_Server
; What protocol the server uses (http or https)
protocol = http

View File

@ -65,6 +65,7 @@ class Controller:
self._load_base_files()
server_config = Config.instance().settings.Server
Config.instance().listen_for_config_changes(self._update_config)
name = server_config.name
host = server_config.host
port = server_config.port
@ -86,7 +87,7 @@ class Controller:
try:
self._local_server = await self.add_compute(
compute_id="local",
name=f"{socket.gethostname()} (controller)",
name=name,
protocol=protocol,
host=host,
console_host=console_host,

View File

@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import socket
from enum import Enum
from pydantic import BaseModel, Field, SecretStr, FilePath, DirectoryPath, validator
from typing import List
@ -123,6 +125,7 @@ class BuiltinSymbolTheme(str, Enum):
class ServerSettings(BaseModel):
local: bool = False
name: str = f"{socket.gethostname()} (controller)"
protocol: ServerProtocol = ServerProtocol.http
host: str = "0.0.0.0"
port: int = Field(3080, gt=0, le=65535)