3v324v23 commited on
Commit
edd7d97
·
1 Parent(s): d54ded2
Files changed (2) hide show
  1. app/survey/view.py +11 -6
  2. docker-compose.yml +2 -1
app/survey/view.py CHANGED
@@ -34,12 +34,17 @@ class SurveyView:
34
  if not settings.GOOGLE_CREDENTIALS_JSON:
35
  raise RuntimeError("Missing GOOGLE_CREDENTIALS_JSON")
36
 
37
- creds_dict = json.loads(settings.GOOGLE_CREDENTIALS_JSON)
38
-
39
- creds = service_account.Credentials.from_service_account_info(
40
- creds_dict,
41
- scopes=["https://www.googleapis.com/auth/spreadsheets"]
42
- )
 
 
 
 
 
43
 
44
  return build("sheets", "v4", credentials=creds)
45
 
 
34
  if not settings.GOOGLE_CREDENTIALS_JSON:
35
  raise RuntimeError("Missing GOOGLE_CREDENTIALS_JSON")
36
 
37
+ if settings.ENV == "hf":
38
+ creds_dict = json.loads(settings.GOOGLE_CREDENTIALS_JSON)
39
+ creds = service_account.Credentials.from_service_account_info(
40
+ creds_dict,
41
+ scopes=["https://www.googleapis.com/auth/spreadsheets"]
42
+ )
43
+ else:
44
+ creds = service_account.Credentials.from_service_account_file(
45
+ settings.GOOGLE_CREDENTIALS_JSON,
46
+ scopes=["https://www.googleapis.com/auth/spreadsheets"]
47
+ )
48
 
49
  return build("sheets", "v4", credentials=creds)
50
 
docker-compose.yml CHANGED
@@ -2,9 +2,10 @@ services:
2
  web:
3
  build: .
4
  ports:
5
- - "3010:3010"
6
  volumes:
7
  - ./.env:/code/.env
 
8
 
9
  env_file:
10
  - ./.env
 
2
  web:
3
  build: .
4
  ports:
5
+ - "8005:7860"
6
  volumes:
7
  - ./.env:/code/.env
8
+ - ./credentials.json:/code/credentials.json
9
 
10
  env_file:
11
  - ./.env