Exemplo n.º 1
0
        public override void Configure(Container container)
        {
            JsConfig.EmitCamelCaseNames = true;
            var appSettings = new TextFileSettings("~/appSettings.txt".MapHostAbsolutePath(), ":");

            container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(
                appSettings.Get("database"),
                SqlServerDialect.Provider));

            container.Register(x => new Log4NetFactory(true));
            LogManager.LogFactory = container.Resolve<Log4NetFactory>();
            container.Register<ILog>(x => LogManager.GetLogger(GetType()));

            AwsAccessKey = appSettings.Get("awsAccessKey");
            AwsSecretKey = appSettings.Get("awsSecretKey");

            Plugins.Add(new CorsFeature());

            using (var db = container.Resolve<IDbConnectionFactory>().Open())
            {
                db.CreateTableIfNotExists<LinkUrls>();
                db.CreateTableIfNotExists<LinkImages>();
            }

            Routes.Add<FindLinkUrl>("/urls/{Id}", "GET")
                .Add<FindLinkUrl>("/urls", "GET")
                .Add<AddLinkUrl>("/urls", "POST")
                .Add<StartGetImages>("/start", "GET");
        }
Exemplo n.º 2
0
 public void TestFixtureSetUp()
 {
     var settings = new TextFileSettings("~/azureconfig.txt".MapProjectPath());
     Host = settings.GetString("Host");
     Port = settings.Get("Port", 6379);
     Password = settings.GetString("Password");
     connectionString = "{0}@{1}".Fmt(Password, Host);
 }
Exemplo n.º 3
0
        public void Import_AppSettings_into_DynamoDb()
        {
            var fileSettings = new TextFileSettings("~/../../deploy/appsettings.txt".MapHostAbsolutePath());
            var dynamoSettings = new DynamoDbAppSettings(AwsConfig.CreatePocoDynamo());
            dynamoSettings.InitSchema();

            //dynamoSettings.Set("SmtpConfig", "{Username:REPLACE_USER,Password:REPLACE_PASS,Host:email-smtp.us-east-1.amazonaws.com,Port:587}");
            foreach (var config in fileSettings.GetAll())
            {
                dynamoSettings.Set(config.Key, config.Value);
            }
        }