Skip to content

Commit

Permalink
fix configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBoot committed Nov 21, 2021
1 parent 28722ed commit ade4f2e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
32 changes: 19 additions & 13 deletions GiganticEmu.Agent/AgentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,52 @@ public class AgentConfiguration
public string BindInterface { get; set; } = "0.0.0.0";
public string? GiganticPath { get; set; }
public int MaxInstances { get; set; } = 1;
public string Title { get; set; } = "Gigantic Control Panel";
public string ServerHost { get; set; } = "127.0.0.1";
public int ServerPort { get; set; } = 7777;
public int WebPort { get; set; } = 8080;
public string[] DefaultCreatures { get; set; } = new string[] { "bloomer", "cerb", "cyclops" };

#region GCP config.json compatibility
private string api_key
private string? api_key
{
get => default!;
set => ApiKey = value;
set { if (value != null) ApiKey = value; }
}
private string? gigantic_path
{
get => default;
set => GiganticPath = value;
set { if (value != null) GiganticPath = value; }
}
private int http_port
private int? http_port
{
get => default;
set => WebPort = value;
set { if (value.HasValue) WebPort = value.Value; }
}
private int max_instances
private int? max_instances
{
get => default;
set => MaxInstances = value;
set { if (value.HasValue) MaxInstances = value.Value; }
}
private int server_port
private int? server_port
{
get => default;
set => ServerPort = value;
set { if (value.HasValue) ServerPort = value.Value; }
}
private string server_url
private string? title
{
get => default!;
set => ServerHost = value;
set { if (value != null) Title = value; }
}
private string[] default_creatures
private string? server_url
{
get => default!;
set => DefaultCreatures = value;
set { if (value != null) ServerHost = value; }
}
private string[]? default_creatures
{
get => default!;
set { if (value != null) DefaultCreatures = value; }
}
#endregion
}
Expand Down
2 changes: 1 addition & 1 deletion GiganticEmu.Agent/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
ViewData["Title"] = @Model.Title;
}

<p>
Expand Down
4 changes: 2 additions & 2 deletions GiganticEmu.Agent/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using GiganticEmu.Shared;
using Microsoft.AspNetCore.Mvc.RazorPages;
Expand All @@ -14,6 +13,7 @@ public class IndexModel : PageModel
private readonly AgentConfiguration _configuration;
private readonly ServerManager _serverManager;

public string Title { get => _configuration.Title; }
public int MaxInstances { get => _configuration.MaxInstances; }
public int RunningInstances { get => _serverManager.RunningInstances; }
public int AvailableInstances { get => MaxInstances - RunningInstances; }
Expand Down

0 comments on commit ade4f2e

Please sign in to comment.