Added parameters and executable.
This commit is contained in:
		
							parent
							
								
									1cd0b54656
								
							
						
					
					
						commit
						46a8b612b4
					
				| @ -34,3 +34,7 @@ dependencies = [ | ||||
|     "multiavatar" | ||||
| ] | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| [project.scripts] | ||||
| snek = "snek.__main__:main" | ||||
|  | ||||
| @ -1,6 +1,32 @@ | ||||
| import argparse | ||||
| from aiohttp import web | ||||
| 
 | ||||
| from snek.app import Application | ||||
| 
 | ||||
| def main(): | ||||
|     parser = argparse.ArgumentParser(description="Run the web application.") | ||||
|     parser.add_argument( | ||||
|         "--port", | ||||
|         type=int, | ||||
|         default=8081, | ||||
|         help="Port to run the application on (default: 8081)" | ||||
|     ) | ||||
|     parser.add_argument( | ||||
|         "--host", | ||||
|         type=str, | ||||
|         default="0.0.0.0", | ||||
|         help="Host to run the application on (default: 0.0.0.0)" | ||||
|     ) | ||||
|     parser.add_argument( | ||||
|         "--db_path", | ||||
|         type=str, | ||||
|         default="snek.db", | ||||
|         help="Database path for the application (default: sqlite:///snek.db)" | ||||
|     ) | ||||
|      | ||||
|     args = parser.parse_args() | ||||
|      | ||||
|     web.run_app(Application(db_path='sqlite:///' + args.db_path), port=args.port, host=args.host) | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     web.run_app(Application(), port=8081, host="0.0.0.0") | ||||
|     main() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user