|  | @@ -1,3 +1,20 @@
 | 
	
		
			
			|  | 1 | +'''
 | 
	
		
			
			|  | 2 | +searx is free software: you can redistribute it and/or modify
 | 
	
		
			
			|  | 3 | +it under the terms of the GNU Affero General Public License as published by
 | 
	
		
			
			|  | 4 | +the Free Software Foundation, either version 3 of the License, or
 | 
	
		
			
			|  | 5 | +(at your option) any later version.
 | 
	
		
			
			|  | 6 | +
 | 
	
		
			
			|  | 7 | +searx is distributed in the hope that it will be useful,
 | 
	
		
			
			|  | 8 | +but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
	
		
			
			|  | 9 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
	
		
			
			|  | 10 | +GNU Affero General Public License for more details.
 | 
	
		
			
			|  | 11 | +
 | 
	
		
			
			|  | 12 | +You should have received a copy of the GNU Affero General Public License
 | 
	
		
			
			|  | 13 | +along with searx. If not, see < http://www.gnu.org/licenses/ >.
 | 
	
		
			
			|  | 14 | +
 | 
	
		
			
			|  | 15 | +(C) 2013- by Adam Tauber, <asciimoo@gmail.com>
 | 
	
		
			
			|  | 16 | +'''
 | 
	
		
			
			|  | 17 | +
 | 
	
		
			
			| 1 | 18 |  from os import environ
 | 
	
		
			
			| 2 | 19 |  from os.path import realpath, dirname, join, abspath
 | 
	
		
			
			| 3 | 20 |  try:
 | 
	
	
		
			
			|  | @@ -10,11 +27,14 @@ except:
 | 
	
		
			
			| 10 | 27 |  searx_dir = abspath(dirname(__file__))
 | 
	
		
			
			| 11 | 28 |  engine_dir = dirname(realpath(__file__))
 | 
	
		
			
			| 12 | 29 |  
 | 
	
		
			
			|  | 30 | +# if possible set path to settings using the enviroment variable SEARX_SETTINGS_PATH
 | 
	
		
			
			| 13 | 31 |  if 'SEARX_SETTINGS_PATH' in environ:
 | 
	
		
			
			| 14 | 32 |      settings_path = environ['SEARX_SETTINGS_PATH']
 | 
	
		
			
			|  | 33 | +# otherwise using default path
 | 
	
		
			
			| 15 | 34 |  else:
 | 
	
		
			
			| 16 | 35 |      settings_path = join(searx_dir, 'settings.yml')
 | 
	
		
			
			| 17 | 36 |  
 | 
	
		
			
			| 18 | 37 |  
 | 
	
		
			
			|  | 38 | +# load settings
 | 
	
		
			
			| 19 | 39 |  with open(settings_path) as settings_yaml:
 | 
	
		
			
			| 20 | 40 |      settings = load(settings_yaml)
 |