@@ -440,12 +440,14 @@ def _show_success_message(self):
440440 self .logger .info ("If you have any questions, please visit the community forum at https://discord.gg/skdcq39Wpv" )
441441 self .logger .highlight ("See you in the community!" )
442442
443- def _get_supertokens_connection_uri (self , protocol : str , api_host : str , supertokens_api_port : int ):
443+ def _get_supertokens_connection_uri (self , protocol : str , api_host : str , supertokens_api_port : int , host_ip : str ):
444444 protocol = protocol .replace ("https" , "http" )
445445 try :
446446 ipaddress .ip_address (api_host )
447- return f"{ protocol } ://{ api_host } "
447+ # If api_host is an IP, use the host_ip instead, x.y.z.w:supertokens_api_port
448+ return f"{ protocol } ://{ host_ip } :{ supertokens_api_port } "
448449 except ValueError :
450+ # If api_host is not IP rather domain, then use domain:supertokens_api_port
449451 return f"{ protocol } ://{ api_host } :{ supertokens_api_port } "
450452
451453 def _update_environment_variables (self , env_values : dict ) -> dict :
@@ -465,13 +467,14 @@ def _update_environment_variables(self, env_values: dict) -> dict:
465467 "WEBSOCKET_URL" : f"{ ws_protocol } ://{ api_host } /ws" ,
466468 "API_URL" : f"{ protocol } ://{ api_host } /api" ,
467469 "WEBHOOK_URL" : f"{ protocol } ://{ api_host } /api/v1/webhook" ,
468- "NEXT_PUBLIC_API_URL" : f"{ protocol } ://{ api_host } /api" ,
469- "NEXT_PUBLIC_WEBSITE_DOMAIN" : f"{ protocol } ://{ view_host } " ,
470+ "VIEW_DOMAIN" : f"{ protocol } ://{ view_host } " ,
470471 "SUPERTOKENS_API_KEY" : "NixopusSuperTokensAPIKey" ,
471472 "SUPERTOKENS_API_DOMAIN" : f"{ protocol } ://{ api_host } /api" ,
472473 "SUPERTOKENS_WEBSITE_DOMAIN" : f"{ protocol } ://{ view_host } " ,
473474 # TODO: temp fix, remove this once we have a secure connection
474- "SUPERTOKENS_CONNECTION_URI" : self ._get_supertokens_connection_uri (protocol , api_host , supertokens_api_port ),
475+ "SUPERTOKENS_CONNECTION_URI" : self ._get_supertokens_connection_uri (
476+ protocol , api_host , supertokens_api_port , host_ip
477+ ),
475478 }
476479
477480 for key , value in key_map .items ():
0 commit comments