Skip to content

Commit

Permalink
fix: only copy config when ui is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
123FLO321 committed Jan 22, 2023
1 parent 5bb7d01 commit 31f38ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/SwiftTileserverCache/tileserver.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Vapor

public func tileserver(_ app: Application) throws {
if !FileManager.default.fileExists(atPath: "TileServer/config.json") {
if !FileManager.default.fileExists(atPath: "TileServer/config.json") &&
(Environment.get("ADMIN_USERNAME")?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "") != "" &&
(Environment.get("ADMIN_PASSWORD")?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "") != "" {
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")
Expand Down

0 comments on commit 31f38ce

Please sign in to comment.