2828from src .models .report import Report as ReportModel
2929from src .models .hourly_average_capacity import HourlyAverageCapacity as HourlyAverageCapacityModel
3030from src .models .user_workout_goal_history import UserWorkoutGoalHistory as UserWorkoutGoalHistoryModel
31+ from src .utils .constants import get_digital_ocean_s3_endpoint_url
3132from src .database import db_session
3233import requests
3334from firebase_admin import messaging
@@ -847,7 +848,11 @@ def mutate(self, info, name, net_id, email, encoded_image=None):
847848 path = f"uplift-dev/user-profile/{ net_id } -profile.png"
848849 region = "nyc3"
849850
850- logging .info (f"DIGITAL_OCEAN_URL: { os .getenv ('DIGITAL_OCEAN_URL' )} " )
851+ logging .info (
852+ "DIGITAL_OCEAN_URL raw=%r normalized=%r" ,
853+ os .getenv ("DIGITAL_OCEAN_URL" ),
854+ get_digital_ocean_s3_endpoint_url (),
855+ )
851856 logging .info (
852857 "CreateUser profile picture upload: net_id=%s, bucket=%s, key=%s" ,
853858 net_id ,
@@ -869,7 +874,7 @@ def mutate(self, info, name, net_id, email, encoded_image=None):
869874 logging .info ("Attempting S3 put_object for new user profile picture..." )
870875 s3 = boto3 .client (
871876 "s3" ,
872- endpoint_url = os . getenv ( "DIGITAL_OCEAN_URL" ),
877+ endpoint_url = get_digital_ocean_s3_endpoint_url ( ),
873878 aws_access_key_id = os .getenv ("DIGITAL_OCEAN_ACCESS" ),
874879 aws_secret_access_key = os .getenv ("DIGITAL_OCEAN_SECRET_ACCESS" ),
875880 config = Config (s3 = {"addressing_style" : "path" }),
@@ -925,7 +930,11 @@ def mutate(self, info, user_id, name=None, email=None, encoded_image=None):
925930 path = f"uplift-dev/user-profile/{ existing_user .net_id } -profile.png"
926931 region = "nyc3"
927932
928- logging .info (f"DIGITAL_OCEAN_URL: { os .getenv ('DIGITAL_OCEAN_URL' )} " )
933+ logging .info (
934+ "DIGITAL_OCEAN_URL raw=%r normalized=%r" ,
935+ os .getenv ("DIGITAL_OCEAN_URL" ),
936+ get_digital_ocean_s3_endpoint_url (),
937+ )
929938 logging .info (
930939 "EditUser profile picture upload: user_id=%s, net_id=%s, bucket=%s, key=%s" ,
931940 user_id ,
@@ -948,7 +957,7 @@ def mutate(self, info, user_id, name=None, email=None, encoded_image=None):
948957 logging .info ("Attempting S3 put_object for edited user profile picture..." )
949958 s3 = boto3 .client (
950959 "s3" ,
951- endpoint_url = os . getenv ( "DIGITAL_OCEAN_URL" ),
960+ endpoint_url = get_digital_ocean_s3_endpoint_url ( ),
952961 aws_access_key_id = os .getenv ("DIGITAL_OCEAN_ACCESS" ),
953962 aws_secret_access_key = os .getenv ("DIGITAL_OCEAN_SECRET_ACCESS" ),
954963 config = Config (s3 = {"addressing_style" : "path" }),
@@ -1231,15 +1240,19 @@ def mutate(self, info, user_id):
12311240 if int (get_jwt_identity ()) != user_id :
12321241 raise GraphQLError ("Unauthorized operation" )
12331242
1234- logging .info (f"DIGITAL_OCEAN_URL: { os .getenv ('DIGITAL_OCEAN_URL' )} " )
1243+ logging .info (
1244+ "DIGITAL_OCEAN_URL raw=%r normalized=%r" ,
1245+ os .getenv ("DIGITAL_OCEAN_URL" ),
1246+ get_digital_ocean_s3_endpoint_url (),
1247+ )
12351248 logging .info (f"User encoded_image: { user .encoded_image } " )
12361249
12371250 if user .encoded_image :
12381251 try :
12391252 logging .info ("Attempting S3 delete..." )
12401253 s3 = boto3 .client (
12411254 "s3" ,
1242- endpoint_url = os . getenv ( "DIGITAL_OCEAN_URL" ),
1255+ endpoint_url = get_digital_ocean_s3_endpoint_url ( ),
12431256 aws_access_key_id = os .getenv ("DIGITAL_OCEAN_ACCESS" ),
12441257 aws_secret_access_key = os .getenv ("DIGITAL_OCEAN_SECRET_ACCESS" ),
12451258 config = Config (s3 = {"addressing_style" : "path" }),
0 commit comments