changing device name for servers

This commit is contained in:
Ayush Saini 2022-10-08 22:21:54 +05:30
parent ad06b244a0
commit 81f76c44a8
2 changed files with 13 additions and 1 deletions

View File

@ -573,6 +573,11 @@ class ServerManagerApp:
# slight behavior tweaks. Hmm; should this be an argument instead?
os.environ['BA_SERVER_WRAPPER_MANAGED'] = '1'
# Set an environment var to change the device name.
# Device name is used while making connection with master server,
# cloud-console recognize us with this name.
os.environ['BA_HOST_NAME'] = self._config.party_name
print(f'{Clr.CYN}Launching server subprocess...{Clr.RST}', flush=True)
binary_name = ('BallisticaCoreHeadless.exe'
if os.name == 'nt' else './ballisticacore_headless')

View File

@ -499,7 +499,14 @@ auto Platform::GetDeviceName() -> std::string {
}
auto Platform::DoGetDeviceName() -> std::string {
// Just go with hostname as a decent default.
// Check hostname in env_var
char* hostname;
hostname = getenv("BA_HOST_NAME");
if (hostname != NULL) {
return hostname;
}
// Else just go with hostname as a decent default.
char nbuffer[64];
int ret = gethostname(nbuffer, sizeof(nbuffer));
if (ret == 0) {