Last active
June 30, 2021 07:11
-
-
Save gistlyn/eb430d172b85da35724f4fce40d55d2d to your computer and use it in GitHub Desktop.
appsettings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppHost : AppHostBase | |
{ | |
public AppHost() : base("Web",typeof(MyServices).Assembly) | |
{ | |
var customSettings = new FileInfo("appsettings.txt"); | |
if (customSettings.Exists) | |
{ | |
AppSettings = new TextFileSettings(customSettings.FullName); | |
} | |
} | |
public override void Configure(Container container) | |
{ | |
var redisHost = AppSettings.GetString("RedisHost"); | |
if (redisHost != null) | |
{ | |
container.Register<IServerEvents>(c => | |
new RedisServerEvents(new PooledRedisClientManager(redisHost))); | |
container.Resolve<IServerEvents>().Start(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Which port to host Chat app on | |
port 1337 | |
# Change what starting background image should be used | |
background /img/bg.jpg | |
# Don't allow Anon Users to use Remote Control | |
LimitRemoteControlToAuthenticatedUsers False | |
#default settings for all oauth providers uses AuthTest OAuth configured for http://localhost:1337/ | |
oauth.RedirectUrl http://localhost:1337/ | |
oauth.CallbackUrl http://localhost:1337/auth/{0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServerEventsServices : Service | |
{ | |
public IAppSettings AppSettings { get; set; } | |
public void Any(PostRawToChannel request) | |
{ | |
if (!IsAuthenticated && AppSettings.Get("LimitRemoteControlToAuthenticatedUsers", false)) | |
throw new HttpError(HttpStatusCode.Forbidden, "You must be authenticated to use remote control."); | |
//... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment