Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Mar 9, 2023
1 parent 26ab803 commit 363b0f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/config.adb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ package body Config is
GNAT.OS_Lib.OS_Exit (-1);
end Decode_Send_String;

function Parse_And_Check_Config (Filename : String) return Read_Result is
function Read_And_Check_Config (Filename : String) return Read_Result is
Parse_Result : Read_Result;
begin
Parse_Result := File_IO.Load_File (Filename);
Expand Down Expand Up @@ -158,14 +158,15 @@ package body Config is
Put_Line ("Error loading configuration file: " & Filename);
Put_Line (Exception_Message (Error));
GNAT.OS_Lib.OS_Exit (-1);
end Parse_And_Check_Config;
end Read_And_Check_Config;

function Load_Config_File (Filename : String; Verbose : Boolean := False)
return Boolean is
Toml_Parse_Result : constant Read_Result := Parse_And_Check_Config (Filename);
Toml_Parse_Result : constant Read_Result := Read_And_Check_Config (Filename);
Top_Keys : constant Key_Array := Toml_Parse_Result.Value.Keys;
Tabs_Count : Positive;
begin
Conf.Tabs.Clear; -- Ensure Tabs are empty in case we are reloading a configuration
for TK of Top_Keys loop
if Verbose then
Put_Line ("Configuration for " & To_String (TK) & " is...");
Expand Down
2 changes: 1 addition & 1 deletion src/config.ads
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ package Config is

Conf : Conf_T;

function Parse_And_Check_Config (Filename : String) return TOML.Read_Result
function Read_And_Check_Config (Filename : String) return TOML.Read_Result
with Pre => (Filename'Length > 0);

function Load_Config_File (Filename : String; Verbose : Boolean := False) return Boolean
Expand Down
4 changes: 3 additions & 1 deletion src/keypadder.adb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ procedure Keypadder is

App_SemVer : constant String := "0.3.0"; -- TODO Update App_SemVer for each release

Max_HTTP_Connections : constant Positive := 2;

Arg_Ix : Natural := 1;
Config_Arg : Unbounded_String := Null_Unbounded_String;
Verbose : Boolean := False;
Expand Down Expand Up @@ -74,7 +76,7 @@ begin
AWS.Server.Start (WS,
Name => "Keypadder Server",
Callback => Frontend.Request_CB'Access,
Max_Connection => 3,
Max_Connection => Max_HTTP_Connections,
Port => Integer (Config.Conf.Keypadder_Conf.Port));
Put_Line ("Server is running on " & AWS.Server.Status.Local_URL (WS));
loop
Expand Down

0 comments on commit 363b0f6

Please sign in to comment.