summaryrefslogtreecommitdiff
path: root/src/server/main.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-11-29 21:20:56 -0500
committerRobby Zambito <contact@robbyzambito.me>2025-11-29 22:46:29 -0500
commit41f4ee721b138304294b185185dc6fc51549c5b9 (patch)
tree8347a6c243108e22df56cef2e9cfe11643724eab /src/server/main.zig
parentbd9ed88e5c7e112f2f4be8234fd11dd9db82d111 (diff)
Switch from clap to yazap
This is compatible with the latest 0.16.0 nightly build. It is also a bit less magic than clap.
Diffstat (limited to 'src/server/main.zig')
-rw-r--r--src/server/main.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/server/main.zig b/src/server/main.zig
index e0058a7..b26f4b0 100644
--- a/src/server/main.zig
+++ b/src/server/main.zig
@@ -3,7 +3,7 @@ const Message = @import("./message_parser.zig");
const ClientState = @import("./client.zig");
-const ServerInfo = struct {
+pub const ServerInfo = struct {
/// The unique identifier of the NATS server.
server_id: []const u8,
/// The name of the NATS server.
@@ -18,7 +18,7 @@ const ServerInfo = struct {
host: []const u8 = "0.0.0.0",
/// The port number the NATS server is configured
/// to listen on.
- port: u16 = 6868,
+ port: u16 = 4222,
/// Whether the server supports headers.
headers: bool = false,
/// Maximum payload size, in bytes, that the server
@@ -36,9 +36,8 @@ clients: std.AutoHashMapUnmanaged(u64, ClientState) = .empty,
/// Map of subjects to client IDs that are subscribed to that subject.
subscriptions: std.StringHashMapUnmanaged(std.ArrayList(u64)),
-pub fn main(gpa: std.mem.Allocator, iter: *std.process.ArgIterator, main_args: anytype) !void {
+pub fn main(gpa: std.mem.Allocator, main_args: anytype) !void {
_ = gpa;
- _ = iter;
_ = main_args;
}
@@ -107,3 +106,11 @@ fn writeInfo(out: *std.Io.Writer, info: ServerInfo) !void {
_ = try out.write("\r\n");
try out.flush();
}
+
+pub fn createId() []const u8 {
+ return "SERVERID";
+}
+
+pub fn createName() []const u8 {
+ return "SERVERNAME";
+}