Ejemplo n.º 1
0
        /// <summary>
        /// Load from an embedded json ressource.
        /// </summary>
        private void LoadFromRessource(string relativePath = ConfigResourcesPath.Path)
        {
            var intermediate = LoadJObject(relativePath);

            if (intermediate == null)
            {
                throw new Exception("Could not read settings json file");
            }
            //App
            var appToken = intermediate["App"];

            ServiceId     = (string)appToken["ServiceId"];
            SetupFinished = (bool)appToken["SetupFinished"];

            //Backend
            var backendTokenIdentity = intermediate["Backend"]["Identity"];

            Identity = new BackendHost
            {
                Host         = (string)backendTokenIdentity["Host"],
                Port         = (int)backendTokenIdentity["Port"],
                Secure       = (bool)backendTokenIdentity["Secure"],
                TimeOut      = (int)backendTokenIdentity["TimeOut"],
                ClientId     = (string)backendTokenIdentity["ClientId"],
                ClientSecret = (string)backendTokenIdentity["ClientSecret"]
            };

            var security = intermediate["Security"];

            Security = new Security
            {
                StorePassword = (string)security["StorePassword"]
            };

            var validation = intermediate["Validation"];

            Validation = new Validation
            {
                PasswordMinLength = (int)validation["PasswordMinLength"],
                UsernameIsEmail   = (bool)validation["UsernameIsEmail"],
                UsernameMinLength = (int)validation["UsernameMinLength"]
            };
        }
Ejemplo n.º 2
0
 public AppSettings(IKeyValueStore store, IServiceSettings keyProvider)
 {
     _store       = store;
     _keyProvider = keyProvider;
     Identity     = new BackendHost();
 }