about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index c5956fc..20afdd6 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -393,10 +393,17 @@ const Cli = struct {
         const root_dir = try Io.Dir.cwd().openDir(io, root_path, .{});
         defer root_dir.close(io);
 
+        const command = blk: {
+            root_dir.access(io, "Caddyfile", .{}) catch |err|
+                switch (err) {
+                    error.FileNotFound => break :blk "caddy file-server -l :1414",
+                    else => return err,
+                };
+            break :blk "caddy fmt --overwrite && caddy run --watch";
+        };
+
         log.info("srv : root={s}", .{root_path});
-        try shell(io,
-            \\caddy fmt --overwrite && caddy run --watch
-        , .{ .cwd = .{ .dir = root_dir } });
+        try shell(io, command, .{ .cwd = .{ .dir = root_dir } });
     }
 };