Sort out running as a user

This commit is contained in:
Adrian Heine 2017-02-28 21:59:16 +01:00
parent f3b70607f1
commit 38cf1d6e98
5 changed files with 33 additions and 14 deletions

View file

@ -49,7 +49,7 @@ pub struct NginxServer<'a, C> where C: Deref<Target=str> {
use std::borrow::Cow;
impl<'a> NginxServer<'a, String> {
pub fn new(home: &'a str, domain: &'a str, static_path: &'a str, redir_domains: &[&'a str], command_runner: &'a CommandRunner) -> Self {
pub fn new(socket_path: &'a str, domain: &'a str, static_path: &'a str, redir_domains: &[&'a str], command_runner: &'a CommandRunner) -> Self {
let file_path: Cow<str> = Cow::from(String::from("/etc/nginx/sites-enabled/") + domain);
let redir_content = redir_domains.iter().map(|redir_domain| format!("server {{
@ -75,10 +75,10 @@ impl<'a> NginxServer<'a, String> {
location @proxy {{
include fastcgi_params;
proxy_pass http://unix:{}/var/service.socket:;
proxy_pass http://unix:{}:;
proxy_redirect off;
}}
}}", domain, static_path, home);
}}", domain, static_path, socket_path);
NginxServer {
command_runner: command_runner,
file: FileSymbol::new(file_path, content)