@@ -315,6 +315,15 @@ bool supervisor_start_web_workflow(void) {
315315 // (leaves new_port unchanged on any failure)
316316 (void )common_hal_os_getenv_int ("CIRCUITPY_WEB_API_PORT" , & web_api_port );
317317
318+ const size_t api_password_len = sizeof (_api_password ) - 1 ;
319+ result = common_hal_os_getenv_str ("CIRCUITPY_WEB_API_PASSWORD" , _api_password + 1 , api_password_len );
320+ if (result == GETENV_OK ) {
321+ _api_password [0 ] = ':' ;
322+ _base64_in_place (_api_password , strlen (_api_password ), sizeof (_api_password ) - 1 );
323+ } else {
324+ return false;
325+ }
326+
318327 bool first_start = pool .base .type != & socketpool_socketpool_type ;
319328
320329 if (first_start ) {
@@ -346,13 +355,6 @@ bool supervisor_start_web_workflow(void) {
346355 }
347356 #endif
348357
349- const size_t api_password_len = sizeof (_api_password ) - 1 ;
350- result = common_hal_os_getenv_str ("CIRCUITPY_WEB_API_PASSWORD" , _api_password + 1 , api_password_len );
351- if (result == GETENV_OK ) {
352- _api_password [0 ] = ':' ;
353- _base64_in_place (_api_password , strlen (_api_password ), sizeof (_api_password ) - 1 );
354- }
355-
356358 if (common_hal_socketpool_socket_get_closed (& listening )) {
357359 socketpool_socket (& pool , SOCKETPOOL_AF_INET , SOCKETPOOL_SOCK_STREAM , & listening );
358360 common_hal_socketpool_socket_settimeout (& listening , 0 );
0 commit comments