ソースを参照

service udpates

George Baugh 1 年間 前
親
コミット
7f915def14
2 ファイル変更、7 行追加、4 行削除
  1. 4 0
      lib/TPSGI.pm
  2. 3 4
      service/tpsgi.sh

+ 4 - 0
lib/TPSGI.pm

@@ -205,6 +205,9 @@ sub new {
     $options{indices} //=[];
     $options{indices} = [@{$options{indices}},qw{index.html index.htm index.cgi}];
 
+    my $num_routes = keys(%routes);
+    INFO("Parsed $num_routes routes from config in $ENV{HOME}/.tpsgi");
+
     $options{routes} = \%routes;
     $options{ip} = '0.0.0.0';
     return bless(\%options, $class);
@@ -765,6 +768,7 @@ sub get_config {
         loggers    => [],
         auth       => undef,
         domain     => '',
+        user       => '',
     );
    	my $config_file = "$ENV{HOME}/.tpsgi.ini";
 	if (-f $config_file) {

+ 3 - 4
service/tpsgi.sh

@@ -5,18 +5,17 @@ echo "Set HOME to $HOME"
 
 cd $HOME
 echo "Changed directory to $HOME"
+# Make sure this is referring to the right perl env
+source .bashrc
 
 USERNAME=$(bin/tpsgi-config --user)
 [[ -z $USERNAME ]] && USERNAME=$USER
 echo "tPSGI running as user $USERNAME"
 
 [[ -e run/tpsgi.pid ]] && sudo pkill -F run/tpsgi.pid
-source perl5/perlbrew/etc/bashrc
 
 # We should obey the PATH set by this user, whose homedir is right here, ideally. 
-PERL=$(sudo -i -u $USERNAME which perl)
-STARMAN=$(sudo -i -u $USERNAME which starman)
-sudo $PERL $STARMAN www/server.psgi --listen run/tpsgi.sock --workers 20 --user "$USERNAME" --daemonize --pid run/tpsgi.pid --chroot $(pwd)
+bin/tpsgi --listen run/tpsgi.sock --workers 20 --user "$USERNAME" --daemonize --pid run/tpsgi.pid --chroot $(pwd)
 
 # Wait until the socket file is ready
 until [ -e run/tpsgi.sock ]