moving magic secret string uris

This commit is contained in:
Andy Pack 2022-11-29 22:46:53 +00:00
parent c7fe8fada5
commit 1ec929ce98
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
6 changed files with 11 additions and 10 deletions

View File

@ -4,7 +4,7 @@ from music.model.user import User
from music.model.config import Config from music.model.config import Config
from music.auth.jwt_keys import generate_key from music.auth.jwt_keys import generate_key
from music.api.decorators import no_cache from music.api.decorators import no_cache
from music.cloud import SPOT_CLIENT_URI, SPOT_SECRET_URI from music.magic_strings import SPOT_CLIENT_URI, SPOT_SECRET_URI
from urllib.parse import urlencode, urlunparse from urllib.parse import urlencode, urlunparse
import datetime import datetime
@ -78,6 +78,7 @@ def logout():
flash('logged out') flash('logged out')
return redirect(url_for('index')) return redirect(url_for('index'))
@blueprint.route('/token', methods=['POST']) @blueprint.route('/token', methods=['POST'])
@no_cache @no_cache
def jwt_token(): def jwt_token():

View File

@ -1,6 +1,6 @@
from datetime import timedelta, datetime, timezone from datetime import timedelta, datetime, timezone
import jwt import jwt
from music.cloud import JWT_SECRET_URI from music.magic_strings import JWT_SECRET_URI
from music.model.user import User from music.model.user import User
from google.cloud import secretmanager from google.cloud import secretmanager

View File

@ -10,12 +10,6 @@ from .tasks import run_user_playlist_task
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
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"
def queue_run_user_playlist(username: str, playlist_name: str): def queue_run_user_playlist(username: str, playlist_name: str):
config = Config.collection.get("config/music-tools") config = Config.collection.get("config/music-tools")

View File

@ -8,7 +8,7 @@ from spotframework.net.user import NetworkUser
from fmframework.net.network import Network as FmNetwork from fmframework.net.network import Network as FmNetwork
from music.model.user import User from music.model.user import User
from music.cloud import SPOT_CLIENT_URI, SPOT_SECRET_URI, LASTFM_CLIENT_URI from music.magic_strings import SPOT_CLIENT_URI, SPOT_SECRET_URI, LASTFM_CLIENT_URI
from google.cloud import secretmanager from google.cloud import secretmanager

6
music/magic_strings.py Normal file
View File

@ -0,0 +1,6 @@
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"

View File

@ -7,7 +7,7 @@ import os
from music.auth import auth_blueprint from music.auth import auth_blueprint
from music.api import api_blueprint, player_blueprint, fm_blueprint, \ from music.api import api_blueprint, player_blueprint, fm_blueprint, \
spotfm_blueprint, spotify_blueprint, admin_blueprint, tag_blueprint spotfm_blueprint, spotify_blueprint, admin_blueprint, tag_blueprint
from music.cloud import COOKIE_SECRET_URI from music.magic_strings import COOKIE_SECRET_URI
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
secret_client = secretmanager.SecretManagerServiceClient() secret_client = secretmanager.SecretManagerServiceClient()