Merge pull request #524 from imayushsaini/devicename-headless

changing device name for servers
This commit is contained in:
Eric Froemling 2023-01-18 14:19:59 -08:00 committed by GitHub
commit fcb348845f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -624,6 +624,11 @@ class ServerManagerApp:
# slight behavior tweaks. Hmm; should this be an argument instead? # slight behavior tweaks. Hmm; should this be an argument instead?
os.environ['BA_SERVER_WRAPPER_MANAGED'] = '1' 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_DEVICE_NAME'] = self._config.party_name
print(f'{Clr.CYN}Launching server subprocess...{Clr.RST}', flush=True) print(f'{Clr.CYN}Launching server subprocess...{Clr.RST}', flush=True)
binary_name = ( binary_name = (
'BallisticaCoreHeadless.exe' 'BallisticaCoreHeadless.exe'

View File

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