MCPcopy Create free account
hub / github.com/bugy/script-server / init

Function init

src/web/server.py:799–905  ·  view source on GitHub ↗
(server_config: ServerConfig,
         authenticator,
         authorizer,
         execution_service: ExecutionService,
         schedule_service: ScheduleService,
         execution_logging_service: ExecutionLoggingService,
         config_service: ConfigService,
         alerts_service: AlertsService,
         file_upload_feature: FileUploadFeature,
         file_download_feature: FileDownloadFeature,
         secret,
         server_version,
         conf_folder,
         *,
         start_server=True)

Source from the content-addressed store, hash-verified

797
798
799def init(server_config: ServerConfig,
800 authenticator,
801 authorizer,
802 execution_service: ExecutionService,
803 schedule_service: ScheduleService,
804 execution_logging_service: ExecutionLoggingService,
805 config_service: ConfigService,
806 alerts_service: AlertsService,
807 file_upload_feature: FileUploadFeature,
808 file_download_feature: FileDownloadFeature,
809 secret,
810 server_version,
811 conf_folder,
812 *,
813 start_server=True):
814 ssl_context = None
815 if server_config.is_ssl():
816 ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
817 ssl_context.load_cert_chain(server_config.get_ssl_cert_path(),
818 server_config.get_ssl_key_path())
819
820 auth = TornadoAuth(authenticator)
821 if auth.is_enabled():
822 identification = AuthBasedIdentification(auth)
823 else:
824 identification = IpBasedIdentification(server_config.ip_validator, server_config.user_header_name)
825
826 downloads_folder = file_download_feature.get_result_files_folder()
827
828 handlers = [(r'/conf', GetServerConf),
829 (r'/scripts', GetScripts),
830 (r'/scripts/([^/]*)', ScriptConfigSocket),
831 (r'/scripts/([^/]*)/([^/]*)/list-files', ScriptParameterListFiles),
832 (r'/executions/start', ScriptExecute),
833 (r'/executions/stop/(.*)', ScriptStop),
834 (r'/executions/kill/(.*)', ScriptKill),
835 (r'/executions/io/(.*)', ScriptStreamSocket),
836 (r'/executions/active', GetActiveExecutionIds),
837 (r'/executions/config/(.*)', GetExecutingScriptConfig),
838 (r'/executions/cleanup/(.*)', CleanupExecutingScript),
839 (r'/executions/status/(.*)', GetExecutionStatus),
840 (r'/history/execution_log/short', GetShortHistoryEntriesHandler),
841 (r'/history/execution_log/long/(.*)', GetLongHistoryEntryHandler),
842 (r'/schedule', AddSchedule),
843 (r'/auth/info', AuthInfoHandler),
844 (r'/result_files/(.*)',
845 DownloadResultFile,
846 {'path': downloads_folder}),
847 (r'/admin/scripts', AdminUpdateScriptEndpoint),
848 (r'/admin/scripts/([^/]+)', AdminScriptEndpoint),
849 (r'/admin/scripts/([^/]*)/code', AdminGetScriptCodeEndpoint),
850 (r"/", ProxiedRedirectHandler, {"url": "/index.html"})]
851
852 if auth.is_enabled():
853 handlers.append((r'/login', LoginHandler))
854 handlers.append((r'/auth/config', AuthConfigHandler))
855 handlers.append((r'/logout', LogoutHandler))
856

Callers

nothing calls this directly

Calls 12

is_enabledMethod · 0.95
TornadoAuthClass · 0.90
autoapply_xheadersFunction · 0.90
is_sslMethod · 0.80
get_ssl_cert_pathMethod · 0.80
get_ssl_key_pathMethod · 0.80
appendMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected