Skip to content

Commit

Permalink
fix: fix initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
123FLO321 committed Mar 1, 2022
1 parent f51aa69 commit 294b650
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Resources/TileServer/Empty.mbtiles
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal class StylesController {
}
})
}

internal func analyse(request: Request, id: String) -> EventLoopFuture<Style.Analysis> {
return analyseUsage(request: request, id: id).flatMap({ usage in
return self.analyseAvilableIcons(request: request, id: id).flatMapThrowing({ icons in
Expand All @@ -73,8 +73,12 @@ internal class StylesController {
missingIcons: missingIcons
)
})
}).recover({ _ in
return .init(
missingFonts: ["error loading style"],
missingIcons: ["error loading style"]
)
})

}

internal func addExternal(request: Request) throws -> EventLoopFuture<HTTPStatus> {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftTileserverCache/Misc/CacheCleaner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CacheCleaner {
let thread = DispatchQueue(label: "CacheCleaner-\(folder)")
try? FileManager.default.createDirectory(atPath: folder, withIntermediateDirectories: true)
if maxAgeMinutes != nil && clearDelaySeconds != nil {
self.logger.notice("Starting CacheCleaner for \(folder) with maxAgeMinutes: \(maxAgeMinutes) and clearDelaySeconds: \(clearDelaySeconds)")
self.logger.notice("Starting CacheCleaner for \(folder) with maxAgeMinutes: \(maxAgeMinutes!) and clearDelaySeconds: \(clearDelaySeconds!)")
thread.async {
while true {
self.runOnce()
Expand Down
3 changes: 2 additions & 1 deletion Sources/SwiftTileserverCache/tileserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Vapor

public func tileserver(_ app: Application) throws {
if !FileManager.default.fileExists(atPath: "TileServer/config.json") {
app.logger.info("Copying default TileServer config.json")
app.logger.info("Copying default TileServer configuration")
try FileManager.default.copyItem(atPath: "Resources/TileServer/config.json", toPath: "TileServer/config.json")
try FileManager.default.copyItem(atPath: "Resources/TileServer/Empty.mbtiles", toPath: "TileServer/Datasets/Combined.mbtiles")
}
}

0 comments on commit 294b650

Please sign in to comment.