mirror of
https://github.com/MAKS-IT-COM/maksit-certs-ui.git
synced 2025-12-31 04:00:03 +01:00
environment logic improvement
This commit is contained in:
parent
60965753f0
commit
9b4d28ec64
@ -32,11 +32,8 @@ namespace LetsEncrypt
|
||||
}
|
||||
|
||||
public void Run() {
|
||||
|
||||
try
|
||||
{
|
||||
LetsEncrypt.Helpers.Environment env = _appSettings.environments.Where(x => x.name == _appSettings.active).FirstOrDefault();
|
||||
|
||||
_appSettings.environments.Where(env => env.active).ToList().ForEach(env => {
|
||||
try {
|
||||
Console.WriteLine(string.Format("Let's Encrypt C# .Net Core Client, environment: {0}", env.name));
|
||||
|
||||
//loop all customers
|
||||
@ -186,13 +183,16 @@ namespace LetsEncrypt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(env.name == "ProductionV2") {
|
||||
_terminalService.Exec("systemctl restart nginx");
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Console.WriteLine(ex.Message.ToString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
namespace LetsEncrypt.Helpers
|
||||
{
|
||||
public class AppSettings {
|
||||
public string active { get; set; }
|
||||
public Environment [] environments { get; set; }
|
||||
public Customer [] customers { get; set;}
|
||||
}
|
||||
|
||||
public class Environment {
|
||||
public bool active { get; set; }
|
||||
public string name { get; set; }
|
||||
public string url { get; set; }
|
||||
public string cache { get; set; }
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
{
|
||||
"AppSettings": {
|
||||
|
||||
"active": "StagingV2",
|
||||
|
||||
"environments": [
|
||||
{
|
||||
"active": true,
|
||||
"name": "StagingV2",
|
||||
"url": "https://acme-staging-v02.api.letsencrypt.org/directory",
|
||||
|
||||
@ -14,6 +12,7 @@
|
||||
"ssl": "/home/maksym/source/temp"
|
||||
},
|
||||
{
|
||||
"active": false,
|
||||
"name": "ProductionV2",
|
||||
"url": "https://acme-v02.api.letsencrypt.org/directory",
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user