// Copyright 2020-2025 The NATS Authors // Licensed under the Apache License, Version 2.0 namespace ZB.MOM.NatsNet.Server.IntegrationTests.Helpers; /// /// Helpers for generating and writing NATS server configuration files used by /// integration tests. /// public static class ConfigHelper { /// /// Template for a basic JetStream super-cluster node. /// Placeholders: {ServerName}, {ClusterName}, {StoreDir}, {ClusterPort}, {Routes} /// public const string JsSuperClusterTemplate = """ listen: 127.0.0.1:-1 server_name: {ServerName} jetstream: {max_mem_store: 256MB, max_file_store: 2GB, store_dir: '{StoreDir}'} cluster { name: {ClusterName} listen: 127.0.0.1:{ClusterPort} routes = [{Routes}] } accounts { $SYS { users = [ { user: "admin", pass: "s3cr3t!" } ] } } """; /// /// Writes to a temporary file and returns its path. /// The file is deleted when the process exits (via ). /// public static string CreateConfigFile(string content) { var path = Path.Combine(Path.GetTempPath(), $"natsnet_{Guid.NewGuid():N}.conf"); File.WriteAllText(path, content); return path; } }