2013-07-11 12:14:49 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/ *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodeBB  -  A  forum  powered  by  node  in  development  by  designcreateplay 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Copyright  ( C )  2013   DesignCreatePlay  Inc . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									This  program  is  free  software :  you  can  redistribute  it  and / or  modify 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									it  under  the  terms  of  the  GNU  General  Public  License  as  published  by 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									the  Free  Software  Foundation ,  either  version  3  of  the  License ,  or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GNU  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									along  with  this  program .   If  not ,  see  < http : //www.gnu.org/licenses/>.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* /  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var  fs  =  require ( 'fs' ) ,  
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									winston  =  require ( 'winston' ) , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 13:30:48 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pkg  =  require ( './package.json' ) , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									url  =  require ( 'url' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-05 11:26:50 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 13:31:04 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								nconf  =  require ( 'nconf' ) ;  
						 
					
						
							
								
									
										
										
										
											2013-06-21 13:28:55 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Runtime environment
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								global . env  =  process . env . NODE _ENV  ||  'production' ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Configuration setup
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								nconf . argv ( ) . file ( {  file :  _ _dirname  +  '/config.json' } ) ;  
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								winston . remove ( winston . transports . Console ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . add ( winston . transports . Console ,  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									colorize : true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . add ( winston . transports . File ,  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filename : 'error.log' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									level : 'error' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// TODO: remove once https://github.com/flatiron/winston/issues/280 is fixed
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . err  =  function ( err )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									winston . error ( err . stack ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-11 12:10:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Log GNU copyright info along with server info
  
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								winston . info ( 'NodeBB v'  +  pkg . version  +  ' Copyright (C) 2013 DesignCreatePlay Inc.' ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . info ( 'This program comes with ABSOLUTELY NO WARRANTY.' ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . info ( 'This is free software, and you are welcome to redistribute it under certain conditions.' ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								winston . info ( '===' ) ;  
						 
					
						
							
								
									
										
										
										
											2013-07-11 12:10:45 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-09 15:17:50 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( nconf . get ( 'upgrade' ) )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									require ( './src/upgrade' ) . upgrade ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  else  if  ( ! nconf . get ( 'setup' )  &&  nconf . get ( 'base_url' ) )  {  
						 
					
						
							
								
									
										
										
										
											2013-07-19 23:56:30 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									nconf . set ( 'url' ,  nconf . get ( 'base_url' )  +  ( nconf . get ( 'use_port' )  ?  ':'  +  nconf . get ( 'port' )  :  '' )  +  nconf . get ( 'relative_path' )  +  '/' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									nconf . set ( 'upload_url' ,  nconf . get ( 'url' )  +  'uploads/' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-19 13:31:04 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									winston . info ( 'Initializing NodeBB v'  +  pkg . version  +  ', on port '  +  nconf . get ( 'port' )  +  ', using Redis store at '  +  nconf . get ( 'redis:host' )  +  ':'  +  nconf . get ( 'redis:port' )  +  '.' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									winston . info ( 'Base Configuration OK.' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// TODO: Replace this with nconf-redis
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var 	meta  =  require ( './src/meta.js' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									global . config  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									meta . config . get ( function ( config )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for ( c  in  config )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( config . hasOwnProperty ( c ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												global . config [ c ]  =  config [ c ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var  categories  =  require ( './src/categories.js' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											templates  =  require ( './public/src/templates.js' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											webserver  =  require ( './src/webserver.js' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											websockets  =  require ( './src/websockets.js' ) , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-28 01:16:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											plugins  =  require ( './src/plugins' ) , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											admin  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												'categories' :  require ( './src/admin/categories.js' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DEVELOPMENT  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-22 11:42:49 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RDB  =  require ( './src/redis.js' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										global . configuration  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										global . templates  =  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										( function ( config )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config [ 'ROOT_DIRECTORY' ]  =  _ _dirname ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											templates . init ( [ 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-23 03:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												'header' ,  'footer' ,  'logout' ,  'outgoing' ,  'admin/header' ,  'admin/footer' ,  'admin/index' , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												'emails/reset' ,  'emails/reset_plaintext' ,  'emails/email_confirm' ,  'emails/email_confirm_plaintext' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												'emails/header' ,  'emails/footer' ,  'install/header' ,  'install/footer' ,  'install/redis' , 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-06 15:34:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												'noscript/header' ,  'noscript/home' ,  'noscript/category' ,  'noscript/topic' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-17 01:02:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											templates . ready ( webserver . init ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											//setup scripts to be moved outside of the app in future.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											function  setup _categories ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												winston . info ( 'Checking categories...' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												categories . getAllCategories ( function ( data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( data . categories . length  ===  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														winston . info ( 'Setting up default categories...' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														fs . readFile ( config . ROOT _DIRECTORY  +  '/install/data/categories.json' ,  function ( err ,  default _categories )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default _categories  =  JSON . parse ( default _categories ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															for  ( var  category  in  default _categories )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																admin . categories . create ( default _categories [ category ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														winston . info ( 'Hardcoding uid 1 as an admin' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														var  user  =  require ( './src/user.js' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														user . makeAdministrator ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 13:05:15 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														winston . info ( 'Categories OK. Found '  +  data . categories . length  +  ' categories.' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-27 14:02:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 13:05:15 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											setup _categories ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ( global . configuration ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  else  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// New install, ask setup questions
 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( nconf . get ( 'setup' ) )  winston . info ( 'NodeBB Setup Triggered via Command Line' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  winston . info ( 'Configuration not found, starting NodeBB setup' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 16:12:09 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var 	install  =  require ( './src/install' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									process . stdout . write ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										"\nWelcome to NodeBB!\nThis looks like a new installation, so you'll have to answer a "  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										"few questions about your environment before we can proceed.\n\n"  + 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 16:12:09 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										"Press enter to accept the default setting (shown in brackets).\n\n\n" 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 16:12:09 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									install . setup ( function ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 14:45:28 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											winston . error ( 'There was a problem completing NodeBB setup: ' ,  err . message ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 16:12:09 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! nconf . get ( 'setup' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												process . stdout . write ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													"Please start NodeBB again and register a new user. This user will automatically become an administrator.\n\n" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-13 13:05:15 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 16:12:09 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										process . exit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-16 15:22:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}