File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -84,15 +84,21 @@ def get_client(engine: str):
84
84
aws_access_key = os .getenv ('POLLY_AWS_ACCESS_KEY' )
85
85
return PollyClient (credentials = (region , aws_key_id , aws_access_key ))
86
86
elif engine == 'google' :
87
- google_creds_path = os .getenv ("GOOGLE_CREDS_PATH" )
88
- if not google_creds_path :
87
+ creds_path = os .getenv ('GOOGLE_CREDS_PATH' )
88
+ google_creds_json = os .getenv ("GOOGLE_CREDS_JSON" )
89
+
90
+ if not google_creds_json :
91
+ raise ValueError ("GOOGLE_CREDS_JSON environment variable is not set" )
92
+
93
+ if not creds_path :
89
94
raise ValueError ("GOOGLE_CREDS_PATH environment variable is not set" )
90
- else :
91
- if not os .path .exists (google_creds_path ):
92
- raise ValueError (f"Google credentials file not found at { google_creds_path } " )
93
-
94
- logger .info (f"Google credentials path: { google_creds_path } " )
95
- return GoogleClient (credentials = (google_creds_path ))
95
+
96
+ with open (creds_path , "w" ) as f :
97
+ f .write (google_creds_json )
98
+ f .close ()
99
+
100
+ logger .info (f"Google credentials path: { creds_path } " )
101
+ return GoogleClient (credentials = (creds_path ))
96
102
elif engine == 'microsoft' :
97
103
token = os .getenv ('MICROSOFT_TOKEN' )
98
104
region = os .getenv ('MICROSOFT_REGION' )
You can’t perform that action at this time.
0 commit comments