aboutsummaryrefslogtreecommitdiff
path: root/captain/captian.f90
diff options
context:
space:
mode:
Diffstat (limited to 'captain/captian.f90')
-rw-r--r--captain/captian.f9027
1 files changed, 26 insertions, 1 deletions
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 <configfile> 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"