Skip to content

Commit

Permalink
Move RabbitMQ config to appsettins.json
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrodicaprio committed Oct 14, 2022
1 parent 53d8107 commit 5598ba9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Unifiedban.Terminal/Utils/ConfigTools.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

Expand Down Expand Up @@ -277,9 +277,10 @@ private static void ConnectToHub()
Date = DateTime.Now,
Function = "connectToHub()",
Level = Models.SystemLog.Levels.Info,
Message = "Connecting and autenticating to Hub Server",
Message = "Connecting and authenticating to Hub Server",
UserId = -1
});

_connection.StartAsync().Wait();
_connection.InvokeAsync("Identification", CacheData.Configuration["HubServerToken"]);

Expand Down Expand Up @@ -428,11 +429,11 @@ static void LoadRabbitMQManager()
UserId = -1
});
var factory = new ConnectionFactory();
factory.UserName = "fabs";
factory.Password = "";
factory.VirtualHost = "/";
factory.HostName = "10.0.0.4";
factory.Port = 5672;
factory.HostName = CacheData.Configuration?["RabbitMQ:HostName"];
factory.Port = int.Parse(CacheData.Configuration?["RabbitMQ:Port"] ?? string.Empty);
factory.VirtualHost = CacheData.Configuration?["RabbitMQ:VirtualHost"];
factory.UserName = CacheData.Configuration?["RabbitMQ:Username"];
factory.Password = CacheData.Configuration?["RabbitMQ:Password"];
factory.DispatchConsumersAsync = true;

Data.Utils.Logging.AddLog(new Models.SystemLog()
Expand Down
7 changes: 7 additions & 0 deletions Unifiedban.Terminal/appsettings.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
"URL": "",
"Seconds": 30
},
"RabbitMQ": {
"HostName": "10.0.0.0",
"Port": 5672,
"VirtualHost": "/",
"Username": "",
"Password": ""
},
"PastHoursToSkip": 12,
"ThrowPendingUpdates": false
}

0 comments on commit 5598ba9

Please sign in to comment.