➕ SERVER_PROTOCOL is now an official env variable for the json-api to read
This commit is contained in:
		
							parent
							
								
									f14390f4bb
								
							
						
					
					
						commit
						7125fc954d
					
				@ -12,3 +12,4 @@ SERVER_NAME="Freechat Dev Server"
 | 
			
		||||
SERVER_DESCRIPTION="Server for sick development things"
 | 
			
		||||
SERVER_HOSTNAME=localhost
 | 
			
		||||
SERVER_PORT=4536
 | 
			
		||||
SERVER_PROTOCOL=http
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,8 @@ pub struct Config {
 | 
			
		||||
    pub name: String,
 | 
			
		||||
    pub description: String,
 | 
			
		||||
    pub hostname: String,
 | 
			
		||||
    pub port: u16
 | 
			
		||||
    pub port: u16,
 | 
			
		||||
    pub protocol: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn get_config() -> Config {
 | 
			
		||||
@ -19,6 +20,7 @@ pub fn get_config() -> Config {
 | 
			
		||||
        description: var("SERVER_DESCRIPTION").unwrap_or("No description".into()),
 | 
			
		||||
        hostname: var("SERVER_HOSTNAME").expect("Couldn't get url from environment"),
 | 
			
		||||
        port: var("SERVER_PORT").expect("Couldn't get port from environment").parse::<u16>().unwrap(),
 | 
			
		||||
        protocol: var("SERVER_PROTOCOL").expect("Couldn't get protocol from environment")
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user