Exemple #1
0
        public override void Configure(Container container)
        {
            //RockstarsService is powered by PocoDynamo and DynamoDB
            container.Register <IPocoDynamo>(c => new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()));

            //Add S3 Bucket as lowest priority Virtual Path Provider
            //All Razor Views, Markdown Content, imgs, js, css, etc are being served from an S3 Bucket
            var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);

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

            //Register and Create Missing DynamoDB Tables
            var db = container.Resolve <IPocoDynamo>();

            db.RegisterTable <Rockstar>();
            db.InitSchema();

            //Insert Rockstar POCOs in DynamoDB
            db.PutItems(RockstarsService.SeedData);

            Plugins.Add(new RazorFormat());
            Plugins.Add(new MarkdownFormat());

            //Uncomment to check LastModified in S3 for changes and recompile Razor + Markdown pages if needed
            //GetPlugin<MarkdownFormat>().CheckLastModifiedForChanges = true;
            //Plugins.Add(new RazorFormat { CheckLastModifiedForChanges = true });
        }
Exemple #2
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);
        }
        public ImportIntoS3Tasks()
        {
            appHost = new BasicAppHost().Init();

            var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);

            s3 = new S3VirtualFiles(s3Client, AwsConfig.S3BucketName);
        }
Exemple #4
0
        public override void Configure(Container container)
        {
            var s3Client = new AmazonS3Client(
                Environment.GetEnvironmentVariable("S3_ACCESS_KEY"),
                Environment.GetEnvironmentVariable("S3_SECRET_KEY"),
                RegionEndpoint.USEast1);

            VirtualFiles = new S3VirtualFiles(s3Client, "s3-postgresql");

            Plugins.Add(new TemplatePagesFeature());
            Plugins.Add(new SwaggerFeature());
        }
Exemple #5
0
        public override void Configure(Container container)
        {
#if USE_AWS
            var s3Client = new AmazonS3Client(
                Environment.GetEnvironmentVariable("S3_ACCESS_KEY"),
                Environment.GetEnvironmentVariable("S3_SECRET_KEY"),
                RegionEndpoint.USEast1);

            VirtualFiles = new S3VirtualFiles(s3Client, "s3-postgresql");
#endif
            SetConfig(new HostConfig {
                DebugMode       = true,
                AdminAuthSecret = Environment.GetEnvironmentVariable("AUTH_SECRET"),
            });

            Plugins.Add(new TemplatePagesFeature {
                EnableDebugTemplateToAll = true,
            });
            Plugins.Add(new SwaggerFeature());
        }
Exemple #6
0
 public S3VirtualFile(S3VirtualFiles pathProvider, IVirtualDirectory directory)
     : base(pathProvider, directory)
 {
     this.PathProvider = pathProvider;
 }
 public AdminTasks()
 {
     appHost = new BasicAppHost().Init();
     s3      = AwsConfig.CreateS3VirtualPathProvider(appHost, AwsConfig.S3BucketName);
 }
Exemple #8
0
 public S3VirtualDirectory(S3VirtualFiles pathProvider, string dirPath, S3VirtualDirectory parentDir)
     : base(pathProvider, parentDir)
 {
     this.PathProvider = pathProvider;
     this.DirPath      = dirPath;
 }