kopia lustrzana https://github.com/bugout-dev/moonstream
Add MOONSTREAM_AUTO_USER_TOKEN access tokens.
rodzic
ce6d015974
commit
8fbb013885
|
@ -15,7 +15,7 @@ from ..settings import (
|
||||||
DOCS_TARGET_PATH,
|
DOCS_TARGET_PATH,
|
||||||
DOCS_PATHS,
|
DOCS_PATHS,
|
||||||
MOONSTREAM_APPLICATION_ID,
|
MOONSTREAM_APPLICATION_ID,
|
||||||
MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN,
|
MOONSTREAM_AUTO_USER_TOKEN,
|
||||||
ORIGINS,
|
ORIGINS,
|
||||||
bugout_client as bc,
|
bugout_client as bc,
|
||||||
)
|
)
|
||||||
|
@ -47,6 +47,11 @@ app.add_middleware(
|
||||||
|
|
||||||
whitelist_paths: Dict[str, str] = {}
|
whitelist_paths: Dict[str, str] = {}
|
||||||
whitelist_paths.update(DOCS_PATHS)
|
whitelist_paths.update(DOCS_PATHS)
|
||||||
|
whitelist_paths.update(
|
||||||
|
{
|
||||||
|
"/subscriptions/types": "GET"
|
||||||
|
}
|
||||||
|
)
|
||||||
app.add_middleware(BroodAuthMiddleware, whitelist=whitelist_paths)
|
app.add_middleware(BroodAuthMiddleware, whitelist=whitelist_paths)
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,7 +199,7 @@ async def get_available_subscriptions_type(
|
||||||
params = {"type": "subscription_type"}
|
params = {"type": "subscription_type"}
|
||||||
try:
|
try:
|
||||||
resources: BugoutResources = bc.list_resources(
|
resources: BugoutResources = bc.list_resources(
|
||||||
token=MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN, params=params
|
token=MOONSTREAM_AUTO_USER_TOKEN, params=params
|
||||||
)
|
)
|
||||||
except BugoutResponseException as e:
|
except BugoutResponseException as e:
|
||||||
raise HTTPException(status_code=e.status_code, detail=e.detail)
|
raise HTTPException(status_code=e.status_code, detail=e.detail)
|
||||||
|
|
|
@ -13,12 +13,12 @@ MOONSTREAM_DATA_JOURNAL_ID = os.environ.get("MOONSTREAM_DATA_JOURNAL_ID")
|
||||||
if MOONSTREAM_DATA_JOURNAL_ID is None:
|
if MOONSTREAM_DATA_JOURNAL_ID is None:
|
||||||
raise ValueError("MOONSTREAM_DATA_JOURNAL_ID environment variable must be set")
|
raise ValueError("MOONSTREAM_DATA_JOURNAL_ID environment variable must be set")
|
||||||
|
|
||||||
MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN = os.environ.get(
|
MOONSTREAM_AUTO_USER_TOKEN = os.environ.get(
|
||||||
"MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN"
|
"MOONSTREAM_AUTO_USER_TOKEN"
|
||||||
)
|
)
|
||||||
if MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN is None:
|
if MOONSTREAM_AUTO_USER_TOKEN is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"MOONSTREAM_SUBSCRIPTIONS_USER_TOKEN environment variable must be set"
|
"MOONSTREAM_AUTO_USER_TOKEN environment variable must be set"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Origin
|
# Origin
|
||||||
|
|
|
@ -2,3 +2,4 @@ export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream
|
||||||
export MOONSTREAM_OPENAPI_LIST="users,subscriptions"
|
export MOONSTREAM_OPENAPI_LIST="users,subscriptions"
|
||||||
export MOONSTREAM_APPLICATION_ID="<issued_bugout_application_id>"
|
export MOONSTREAM_APPLICATION_ID="<issued_bugout_application_id>"
|
||||||
export MOONSTREAM_DATA_JOURNAL_ID="<bugout_journal_id_to_store_blockchain_data>"
|
export MOONSTREAM_DATA_JOURNAL_ID="<bugout_journal_id_to_store_blockchain_data>"
|
||||||
|
export MOONSTREAM_AUTO_USER_TOKEN="<Access token to application resources>"
|
Ładowanie…
Reference in New Issue