ace/Source/ACE.Common/ConfigManager.cs
Mogwai-TheFurry 610c2d0573 Authentication overhaul and API start (#543)
* WIP

* WIP - MVC app for weenie editor with auth overhaul in place

* removed redundant project

* more WIP.  commiting to rebase

* WIP.  API works, auth partially tied in, swagger works, api host works

* moved auth to a post with a body instead of get

* WIP.  auth fully works.  swagger UI supports auth model.

* added easier auth attribute, updated existing methods for consistency.  should PR this after a couple more hours

* stylecop cleanups

* WIP. commiting to get help with session and connection issues

* forgot to save some changes to a sql script

* got all the login issues squared away.  new auth system is done.

* WIP. getting an out of memory exception i cant track down

* WIP.  PacketInboundLoginRequets reads the JwtToken with 2 bonus (invalid) prepended characters

* updated ReadString32L to suck a little less.  i dont think this is 100% correct though.

* Authentication overhaul complete, APIs begun to support content editing

* appveyor cleanup

* appveyor cleanup, take 2

* appveyor cleanup, take 3

* appveyor cleanup, take 4

* Rename 2017-10-20-auth-overhaul.sql to 2017-10-20-00-auth-overhaul.sql

* Rename 2017-10-20-auth-overhaul-shard.sql to 2017-10-20-00-auth-overhaul-shard.sql

* Rename 2017-10-20-auth-overhaul-world.sql to 2017-10-20-00-auth-overhaul-world.sql

* Update MySqlInstall.bat
2017-10-21 13:32:06 -04:00

39 lines
1.1 KiB
C#

using System;
using System.IO;
using Newtonsoft.Json;
namespace ACE.Common
{
public static class ConfigManager
{
public static MasterConfiguration Config { get; private set; }
/// <summary>
/// initializes from a preloaded configuration
/// </summary>
public static void Initialize(MasterConfiguration configuration)
{
Config = configuration;
}
/// <summary>
/// initializes from a config.json file specified by the path
/// </summary>
public static void Initialize(string path = @"Config.json")
{
try
{
Config = JsonConvert.DeserializeObject<MasterConfiguration>(File.ReadAllText(path));
}
catch (Exception exception)
{
Console.WriteLine("An exception occured while loading the configuration file!");
Console.WriteLine($"Exception: {exception.Message}");
// environment.exit swallows this exception for testing purposes. we want to expose it.
throw;
}
}
}
}