Config: Be able to configure the target_url
This commit is contained in:
		
							parent
							
								
									35893c62bc
								
							
						
					
					
						commit
						67d85a9fc5
					
				
							
								
								
									
										12348
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										12348
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,9 +1,12 @@ | |||||||
| import { Router } from "express"; | import { Router } from "express"; | ||||||
|  | import Config from "../util/Config" | ||||||
| 
 | 
 | ||||||
| const router = Router(); | const router = Router(); | ||||||
| 
 | 
 | ||||||
|  | const url = Config.get().server.root_url; | ||||||
|  | 
 | ||||||
| router.get("/", (req, res) => { | router.get("/", (req, res) => { | ||||||
| 	res.send({ url: "ws://localhost:3002" }); | 	res.send({ url: `ws://${url}:3002` }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| export default router; | export default router; | ||||||
|  | |||||||
| @ -21,6 +21,9 @@ export interface RateLimitOptions { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export interface DefaultOptions { | export interface DefaultOptions { | ||||||
|  | 	server: { | ||||||
|  | 		root_url: string; | ||||||
|  | 	}; | ||||||
| 	general: { | 	general: { | ||||||
| 		instance_id: string; | 		instance_id: string; | ||||||
| 	}; | 	}; | ||||||
| @ -108,6 +111,9 @@ export interface DefaultOptions { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export const DefaultOptions: DefaultOptions = { | export const DefaultOptions: DefaultOptions = { | ||||||
|  | 	server: { | ||||||
|  | 		root_url: "localhost" // we are localhost unless the oposite is specified
 | ||||||
|  | 	}, | ||||||
| 	general: { | 	general: { | ||||||
| 		instance_id: Snowflake.generate(), | 		instance_id: Snowflake.generate(), | ||||||
| 	}, | 	}, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Diego Magdaleno
						Diego Magdaleno