@@ -315,6 +315,15 @@ bool supervisor_start_web_workflow(void) {
315
315
// (leaves new_port unchanged on any failure)
316
316
(void )common_hal_os_getenv_int ("CIRCUITPY_WEB_API_PORT" , & web_api_port );
317
317
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
+
318
327
bool first_start = pool .base .type != & socketpool_socketpool_type ;
319
328
320
329
if (first_start ) {
@@ -346,13 +355,6 @@ bool supervisor_start_web_workflow(void) {
346
355
}
347
356
#endif
348
357
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
-
356
358
if (common_hal_socketpool_socket_get_closed (& listening )) {
357
359
socketpool_socket (& pool , SOCKETPOOL_AF_INET , SOCKETPOOL_SOCK_STREAM , & listening );
358
360
common_hal_socketpool_socket_settimeout (& listening , 0 );
0 commit comments