variable google project id
This commit is contained in:
parent
07d5f42f11
commit
023cdf909f
@ -1,5 +1,6 @@
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
import os
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
@ -10,7 +11,7 @@ from music.api.decorators import login_or_jwt, admin_required, no_locked_users
|
||||
blueprint = Blueprint('admin-api', __name__)
|
||||
|
||||
tasker = tasks_v2.CloudTasksClient()
|
||||
task_path = tasker.queue_path('sarsooxyz', 'europe-west2', 'spotify-executions')
|
||||
task_path = tasker.queue_path(os.environ['GOOGLE_CLOUD_PROJECT'], 'europe-west2', 'spotify-executions')
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
from google.cloud import pubsub_v1
|
||||
|
||||
publisher = pubsub_v1.PublisherClient()
|
||||
@ -23,7 +24,7 @@ def update_tag(username: str, tag_id: str) -> None:
|
||||
logger.error(f'less than two strings provided, {type(username)} / {type(tag_id)}')
|
||||
return
|
||||
|
||||
publisher.publish('projects/sarsooxyz/topics/update_tag', b'', tag_id=tag_id, username=username)
|
||||
publisher.publish(f'projects/{os.environ["GOOGLE_CLOUD_PROJECT"]}/topics/update_tag', b'', tag_id=tag_id, username=username)
|
||||
|
||||
|
||||
def run_user_playlist_function(username: str, playlist_name: str) -> None:
|
||||
@ -44,4 +45,4 @@ def run_user_playlist_function(username: str, playlist_name: str) -> None:
|
||||
logger.error(f'less than two strings provided, {type(username)} / {type(playlist_name)}')
|
||||
return
|
||||
|
||||
publisher.publish('projects/sarsooxyz/topics/run_user_playlist', b'', name=playlist_name, username=username)
|
||||
publisher.publish(f'projects/{os.environ["GOOGLE_CLOUD_PROJECT"]}/topics/run_user_playlist', b'', name=playlist_name, username=username)
|
||||
|
@ -17,7 +17,7 @@ from music.model.playlist import Playlist
|
||||
from music.model.tag import Tag
|
||||
|
||||
tasker = tasks_v2.CloudTasksClient()
|
||||
task_path = tasker.queue_path('sarsooxyz', 'europe-west2', 'spotify-executions')
|
||||
task_path = tasker.queue_path(os.environ['GOOGLE_CLOUD_PROJECT'], 'europe-west2', 'spotify-executions')
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
SPOT_CLIENT_URI = "projects/sarsooxyz/secrets/spotify-client/versions/latest"
|
||||
SPOT_SECRET_URI = "projects/sarsooxyz/secrets/spotify-secret/versions/latest"
|
||||
LASTFM_CLIENT_URI = "projects/sarsooxyz/secrets/lastfm-client/versions/latest"
|
||||
JWT_SECRET_URI = "projects/sarsooxyz/secrets/jwt-secret/versions/latest"
|
||||
COOKIE_SECRET_URI = "projects/sarsooxyz/secrets/cookie-secret/versions/latest"
|
||||
APNS_SIGN_URI = "projects/sarsooxyz/secrets/apns-auth-sign-key/versions/1"
|
||||
import os
|
||||
project_id = os.environ.get('GOOGLE_CLOUD_PROJECT')
|
||||
|
||||
SPOT_CLIENT_URI = f"projects/{project_id}/secrets/spotify-client/versions/latest"
|
||||
SPOT_SECRET_URI = f"projects/{project_id}/secrets/spotify-secret/versions/latest"
|
||||
LASTFM_CLIENT_URI = f"projects/{project_id}/secrets/lastfm-client/versions/latest"
|
||||
JWT_SECRET_URI = f"projects/{project_id}/secrets/jwt-secret/versions/latest"
|
||||
COOKIE_SECRET_URI = f"projects/{project_id}/secrets/cookie-secret/versions/latest"
|
||||
APNS_SIGN_URI = f"projects/{project_id}/secrets/apns-auth-sign-key/versions/1"
|
||||
|
Loading…
Reference in New Issue
Block a user