src/main/scala/s3/website/model/Site.scala in s3_website-2.10.0 vs src/main/scala/s3/website/model/Site.scala in s3_website-2.11.0

- old
+ new

@@ -13,15 +13,14 @@ import scala.util.Failure import s3.website.model.Config.UnsafeYaml import scala.util.Success case class Site(rootDirectory: File, config: Config) { - def resolveS3Key(file: File) = file.getAbsolutePath.replace(rootDirectory.getAbsolutePath, "").replace(File.separator,"/").replaceFirst("^/", "") - - def resolveFile(s3File: S3File): File = resolveFile(s3File.s3Key) - - def resolveFile(s3Key: S3Key): File = new File(s"$rootDirectory/$s3Key") + def resolveS3Key(file: File) = S3Key.build( + file.getAbsolutePath.replace(rootDirectory.getAbsolutePath, "").replace(File.separator,"/").replaceFirst("^/", ""), + config.s3_key_prefix + ) } object Site { def parseConfig(implicit logger: Logger, yamlConfig: S3_website_yml): Either[ErrorReport, Config] = { val yamlObjectTry = for { @@ -42,17 +41,18 @@ max_age <- loadMaxAge.right cache_control <- loadCacheControl.right gzip <- loadOptionalBooleanOrStringSeq("gzip").right gzip_zopfli <- loadOptionalBoolean("gzip_zopfli").right extensionless_mime_type <- loadOptionalString("extensionless_mime_type").right - ignore_on_server <- loadOptionalStringOrStringSeq("ignore_on_server").right - exclude_from_upload <- loadOptionalStringOrStringSeq("exclude_from_upload").right + s3_key_prefix <- loadOptionalString("s3_key_prefix").right + ignore_on_server <- loadOptionalS3KeyRegexes("ignore_on_server").right + exclude_from_upload <- loadOptionalS3KeyRegexes("exclude_from_upload").right s3_reduced_redundancy <- loadOptionalBoolean("s3_reduced_redundancy").right cloudfront_distribution_id <- loadOptionalString("cloudfront_distribution_id").right cloudfront_invalidate_root <- loadOptionalBoolean("cloudfront_invalidate_root").right concurrency_level <- loadOptionalInt("concurrency_level").right - redirects <- loadRedirects.right + redirects <- loadRedirects(s3_key_prefix).right treat_zero_length_objects_as_redirects <- loadOptionalBoolean("treat_zero_length_objects_as_redirects").right } yield { gzip_zopfli.foreach(_ => logger.info( """|Zopfli is not currently supported. Falling back to regular gzip. |If you find a stable Java implementation for zopfli, please send an email to lauri.lehmijoki@iki.fi about it.""" @@ -68,9 +68,10 @@ site, max_age, cache_control, gzip, gzip_zopfli, + s3_key_prefix, ignore_on_server = ignore_on_server, exclude_from_upload = exclude_from_upload, s3_reduced_redundancy, cloudfront_distribution_id, cloudfront_invalidate_root, \ No newline at end of file