@ -63,20 +63,23 @@ impl<'a, R> NodeJsSystemdUserService<'a, String, SetuidCommandRunner<'a, R>> whe
pub fn new ( home : & 'a str , user_name : & 'a str , name : & 'a str , path : & 'a str , command_runner : & 'a R ) -> Self {
let file_path = format ! ( "{}/.config/systemd/user/{}.service" , home . trim_right ( ) , name ) ;
let port = format ! ( "/var/tmp/{}-{}.socket" , user_name , name ) ;
let content = format ! ( " [ Service ]
ExecStartPre = / bin / rm - f / var / tmp / { 1 } - { 2 } . socket
# This only works if the path is a directory
WorkingDirectory = { 0 }
Environment = NODE_ENV = production
Environment = PORT = { 1 }
ExecStartPre = / bin / rm - f { 1 }
ExecStart = / usr / bin / nodejs { 0 }
ExecStartPost = / bin / sh - c 'sleep 1 & & chmod 666 { 1 } '
# FIXME : This only works if the nodejs path is a directory
WorkingDirectory = { 0 }
Restart = always
Environment = NODE_ENV = production
Environment = PORT = / var / tmp / { 1 } - { 2 } . socket
# RuntimeDirectory = service
# RuntimeDirectoryMode = 766
[ Install ]
WantedBy = default . target
" , path , user_name , name ) ;
" , path , port ) ;
NodeJsSystemdUserService {
service_name : name ,
@ -167,9 +170,11 @@ impl<'a, C, R> Symbol for NodeJsSystemdUserService<'a, C, R> where C: Deref<Targ
let file_name = format ! ( "/var/tmp/{}-{}.socket" , self . user_name , self . service_name ) ;
let metadata = try ! ( wait_for_metadata ( & file_name ) ) ;
/*
let mut perms = metadata . permissions ( ) ;
perms . set_mode ( 0o666 ) ;
try ! ( fs ::set_permissions ( file_name , perms ) ) ;
* /
Ok ( ( ) )
}