mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 00:50:45 +01:00
Merge pull request #172 from Cyberboss/WhoCapitalizesIRCChannels
Unhardcodes the remote access port
This commit is contained in:
@@ -111,7 +111,7 @@ namespace TGServerService
|
||||
if (oldVersion == newVersion && newVersion == 0) //chat refactor
|
||||
Properties.Settings.Default.ChatProviderData = "NEEDS INITIALIZING"; //reset chat settings to be safe
|
||||
}
|
||||
|
||||
|
||||
//you should seriously not add anything here
|
||||
//Use OnStart instead
|
||||
public TGServerService()
|
||||
@@ -153,7 +153,15 @@ namespace TGServerService
|
||||
|
||||
var instance = new TGStationServer();
|
||||
|
||||
host = new ServiceHost(instance, new Uri[] { new Uri("net.pipe://localhost"), new Uri(String.Format("https://localhost:{0}", Server.HTTPSPort)) })
|
||||
for (var I = 0; I < args.Length - 1; ++I)
|
||||
if (args[I].ToLower() == "-port")
|
||||
{
|
||||
Config.RemoteAccessPort = Convert.ToUInt16(args[I + 1]);
|
||||
Config.Save();
|
||||
break;
|
||||
}
|
||||
|
||||
host = new ServiceHost(instance, new Uri[] { new Uri("net.pipe://localhost"), new Uri(String.Format("https://localhost:{0}", Config.RemoteAccessPort)) })
|
||||
{
|
||||
CloseTimeout = new TimeSpan(0, 0, 5)
|
||||
};
|
||||
@@ -164,7 +172,14 @@ namespace TGServerService
|
||||
host.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySubjectName, Config.CertificateURL);
|
||||
host.Authorization.ServiceAuthorizationManager = instance;
|
||||
|
||||
host.Open(); //...or maybe here, doesn't really matter
|
||||
try
|
||||
{
|
||||
host.Open();
|
||||
}
|
||||
catch (AddressAlreadyInUseException e)
|
||||
{
|
||||
throw new Exception("Can't start the service due to the configured remote access port being in use. To fix this change it by starting the service with the \"-port <port>\" argument.", e);
|
||||
}
|
||||
}
|
||||
|
||||
//shorthand for adding the WCF endpoint
|
||||
|
||||
Reference in New Issue
Block a user