From 8ca6d21882c521fb78f1325e9a88a558364b3ad4 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 6 May 2021 10:17:03 -0400 Subject: CGI interface at least starts properly. Fixed rendering of templates to actually take place in CGI mode. --- captain/captian.f90 | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'captain/captian.f90') diff --git a/captain/captian.f90 b/captain/captian.f90 index 4ee637e..76ea768 100644 --- a/captain/captian.f90 +++ b/captain/captian.f90 @@ -23,7 +23,7 @@ program captain use captain_db use config -use logging, only: initialize_log => initialize, shutdown_log => shutdown +use logging, only: initialize_log => initialize, shutdown_log => shutdown, write_log, LOG_INFO use gemini, only: handle_gemini => handle_request use web, only: handle_web => handle_request implicit none @@ -48,6 +48,9 @@ implicit none end select call shutdown_db() + + call write_log("Process complete", LOG_INFO) + call shutdown_log() contains @@ -67,6 +70,10 @@ contains Print *, " -c Use the specified config file" Print *, " -g Operate in Gemini mode" Print *, " -w Operate in CGI mode (default)" + Print *, " " + Print *, "Config file can also be specified via the environment variables:" + Print *, " LEVITATING_CONFIG_CGI Path to config for CGI mode" + Print *, " LEVITATING_CONFIG_GEMINI Path to config for Gemini mode" end subroutine usage @@ -104,6 +111,24 @@ contains i = i + 1 end do + if(.not. config_loaded) then + call get_environment_variable("LEVITATING_CONFIG_CGI", value=option, status=i) + if(i == 0) then + call load_configuration(trim(option)) + config_loaded = .true. + mode = MODE_CGI_HTML + end if + end if + + if(.not. config_loaded) then + call get_environment_variable("LEVITATING_CONFIG_GEMINI", value=option, status=i) + if(i == 0) then + call load_configuration(trim(option)) + config_loaded = .true. + mode = MODE_GEMINI + end if + end if + ! Assign working directory from command if not specified if(.not. config_loaded) then Print *, "No configuration file specified" -- cgit v1.2.3