Beispiel #1
0
        public override void Configure(Container container)
        {
            SetConfig(new HostConfig
            {
                UseCamelCase = true,
            });

            Plugins.Add(new RazorFormat());

            //Comment out 2 lines below to change to use local FileSystem instead of S3
            var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);

            VirtualFiles = new S3VirtualFiles(s3Client, AwsConfig.S3BucketName);
            AddVirtualFileSources.Add(VirtualFiles);

            container.Register <IPocoDynamo>(c => new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()));
            var db = container.Resolve <IPocoDynamo>();

            db.RegisterTable <Todos.Todo>();
            db.RegisterTable <EmailContacts.Email>();
            db.RegisterTable <EmailContacts.Contact>();
            db.InitSchema();

            //AWS Auth
            container.Register <ICacheClient>(new DynamoDbCacheClient(db, initSchema: true));
            container.Register <IAuthRepository>(new DynamoDbAuthRepository(db, initSchema: true));
            Plugins.Add(CreateAuthFeature());

            //EmailContacts
            ConfigureSqsMqServer(container);
            ConfigureEmailer(container);
            Plugins.Add(new ValidationFeature());
            container.RegisterValidators(typeof(EmailContacts.CreateContact).Assembly);
        }
Beispiel #2
0
        public AppHost() : base("AWS Examples", typeof(AppHost).Assembly)
        {
#if DEBUG
            LogManager.LogFactory = new StringBuilderLogFactory(); //View logs at /logs
#else
            //Deployed RELEASE build uses Config settings in DynamoDb
            AppSettings = new MultiAppSettings(
                new DynamoDbAppSettings(new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()), initSchema: true),
                new AppSettings());
#endif
        }
Beispiel #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);
            }
        }
Beispiel #4
0
 public AdminTasks()
 {
     appHost = new BasicAppHost().Init();
     s3      = AwsConfig.CreateS3VirtualPathProvider(appHost, AwsConfig.S3BucketName);
 }