diff --git a/src/infrastructure/config/settings.py b/src/infrastructure/config/settings.py index 858100e..a3ae7d3 100644 --- a/src/infrastructure/config/settings.py +++ b/src/infrastructure/config/settings.py @@ -247,13 +247,9 @@ class Settings(BaseSettings): s3_rel_path = self.VAULT_S3_SECRET_PATH.strip() if s3_rel_path: - try: - s3_secret_data = client.read_secret(s3_rel_path) - except Exception as exc: - raise ValueError( - f'Vault S3 secret not readable at mount {self.VAULT_MOUNT_POINT}/{s3_rel_path}: {exc!r}' - ) from exc - self._apply_s3_from_vault_secret(s3_secret_data) + s3_secret_data = client.read_secret_optional(s3_rel_path) + if s3_secret_data: + self._apply_s3_from_vault_secret(s3_secret_data) if not self.DATABASE_URL: raise ValueError('Database URL could not be built from Vault database secret') diff --git a/src/presentation/routing/account_settings.py b/src/presentation/routing/account_settings.py index d8ca970..0cd690a 100644 --- a/src/presentation/routing/account_settings.py +++ b/src/presentation/routing/account_settings.py @@ -80,119 +80,119 @@ async def set_avatar( pub = me_user_public(user) return SetAvatarPublicResponse(**pub.model_dump(), webp_size_bytes=webp_size) - -@account_settings_router.post(path='/encrypted-mnemonic/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def encrypted_mnemonic_start( - request: Request, - auth: AuthContext = Depends(require_access_token), - command: SetEncryptedMnemonicStartCommand = Depends(get_set_encrypted_mnemonic_start_command), -): - result = await command(user_id=auth.user_id) - return {'success': result} - - -@account_settings_router.post(path='/encrypted-mnemonic/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def encrypted_mnemonic_complete( - request: Request, - body: EncryptedMnemonicConfirmRequest, - auth: AuthContext = Depends(require_access_token), - command: SetEncryptedMnemonicCompleteCommand = Depends(get_set_encrypted_mnemonic_complete_command), -): - user = await command( - user_id=auth.user_id, - code=body.code, - encrypted_mnemonic=body.encrypted_mnemonic, - ) - return {'encrypted_mnemonic': user.encrypted_mnemonic} - - -@account_settings_router.post(path='/email/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def change_email_start( - request: Request, - auth: AuthContext = Depends(require_access_token), - command: ChangeEmailStartCommand = Depends(get_change_email_start_command), -): - result = await command(user_id=auth.user_id) - return {'success': result} - - -@account_settings_router.post(path='/email/confirm-old', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def change_email_confirm_old( - request: Request, - body: ChangeEmailConfirmOldRequest, - auth: AuthContext = Depends(require_access_token), - command: ChangeEmailConfirmOldCommand = Depends(get_change_email_confirm_old_command), -): - result = await command(user_id=auth.user_id, code=body.code, new_email=body.new_email) - return {'success': result} - - -@account_settings_router.post(path='/email/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def change_email_complete( - request: Request, - body: ChangeEmailCompleteRequest, - auth: AuthContext = Depends(require_access_token), - command: ChangeEmailCompleteCommand = Depends(get_change_email_complete_command), -): - result = await command(user_id=auth.user_id, code=body.code) - return {'success': result} - - -@account_settings_router.post(path='/password/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def change_password_start( - request: Request, - auth: AuthContext = Depends(require_access_token), - command: ChangePasswordStartCommand = Depends(get_change_password_start_command), -): - result = await command(user_id=auth.user_id) - return {'success': result} - - -@account_settings_router.post(path='/password/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def change_password_complete( - request: Request, - body: ChangePasswordConfirmRequest, - auth: AuthContext = Depends(require_access_token), - command: ChangePasswordCompleteCommand = Depends(get_change_password_complete_command), -): - result = await command( - user_id=auth.user_id, - code=body.code, - new_password=body.new_password, - confirm_password=body.confirm_password, - ) - return {'success': result} - - -@account_settings_router.post(path='/bank/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def bank_details_start( - request: Request, - auth: AuthContext = Depends(require_access_token), - command: UpdateBankDetailsStartCommand = Depends(get_update_bank_details_start_command), -): - result = await command(user_id=auth.user_id) - return {'success': result} - - -@account_settings_router.post(path='/bank/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) -async def bank_details_complete( - request: Request, - body: BankConfirmRequest, - auth: AuthContext = Depends(require_access_token), - command: UpdateBankDetailsCompleteCommand = Depends(get_update_bank_details_complete_command), -): - user = await command( - user_id=auth.user_id, - code=body.code, - passport_data=body.passport_data, - inn=body.inn, - erc20=body.erc20, - ) - return ORJSONResponse( - status_code=status.HTTP_200_OK, - content={ - 'passport_data': user.passport_data, - 'inn': user.inn, - 'erc20': user.erc20, - }, - ) +# +# @account_settings_router.post(path='/encrypted-mnemonic/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def encrypted_mnemonic_start( +# request: Request, +# auth: AuthContext = Depends(require_access_token), +# command: SetEncryptedMnemonicStartCommand = Depends(get_set_encrypted_mnemonic_start_command), +# ): +# result = await command(user_id=auth.user_id) +# return {'success': result} +# +# +# @account_settings_router.post(path='/encrypted-mnemonic/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def encrypted_mnemonic_complete( +# request: Request, +# body: EncryptedMnemonicConfirmRequest, +# auth: AuthContext = Depends(require_access_token), +# command: SetEncryptedMnemonicCompleteCommand = Depends(get_set_encrypted_mnemonic_complete_command), +# ): +# user = await command( +# user_id=auth.user_id, +# code=body.code, +# encrypted_mnemonic=body.encrypted_mnemonic, +# ) +# return {'encrypted_mnemonic': user.encrypted_mnemonic} +# +# +# @account_settings_router.post(path='/email/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def change_email_start( +# request: Request, +# auth: AuthContext = Depends(require_access_token), +# command: ChangeEmailStartCommand = Depends(get_change_email_start_command), +# ): +# result = await command(user_id=auth.user_id) +# return {'success': result} +# +# +# @account_settings_router.post(path='/email/confirm-old', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def change_email_confirm_old( +# request: Request, +# body: ChangeEmailConfirmOldRequest, +# auth: AuthContext = Depends(require_access_token), +# command: ChangeEmailConfirmOldCommand = Depends(get_change_email_confirm_old_command), +# ): +# result = await command(user_id=auth.user_id, code=body.code, new_email=body.new_email) +# return {'success': result} +# +# +# @account_settings_router.post(path='/email/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def change_email_complete( +# request: Request, +# body: ChangeEmailCompleteRequest, +# auth: AuthContext = Depends(require_access_token), +# command: ChangeEmailCompleteCommand = Depends(get_change_email_complete_command), +# ): +# result = await command(user_id=auth.user_id, code=body.code) +# return {'success': result} +# +# +# @account_settings_router.post(path='/password/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def change_password_start( +# request: Request, +# auth: AuthContext = Depends(require_access_token), +# command: ChangePasswordStartCommand = Depends(get_change_password_start_command), +# ): +# result = await command(user_id=auth.user_id) +# return {'success': result} +# +# +# @account_settings_router.post(path='/password/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def change_password_complete( +# request: Request, +# body: ChangePasswordConfirmRequest, +# auth: AuthContext = Depends(require_access_token), +# command: ChangePasswordCompleteCommand = Depends(get_change_password_complete_command), +# ): +# result = await command( +# user_id=auth.user_id, +# code=body.code, +# new_password=body.new_password, +# confirm_password=body.confirm_password, +# ) +# return {'success': result} +# +# +# @account_settings_router.post(path='/bank/start', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def bank_details_start( +# request: Request, +# auth: AuthContext = Depends(require_access_token), +# command: UpdateBankDetailsStartCommand = Depends(get_update_bank_details_start_command), +# ): +# result = await command(user_id=auth.user_id) +# return {'success': result} +# +# +# @account_settings_router.post(path='/bank/complete', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) +# async def bank_details_complete( +# request: Request, +# body: BankConfirmRequest, +# auth: AuthContext = Depends(require_access_token), +# command: UpdateBankDetailsCompleteCommand = Depends(get_update_bank_details_complete_command), +# ): +# user = await command( +# user_id=auth.user_id, +# code=body.code, +# passport_data=body.passport_data, +# inn=body.inn, +# erc20=body.erc20, +# ) +# return ORJSONResponse( +# status_code=status.HTTP_200_OK, +# content={ +# 'passport_data': user.passport_data, +# 'inn': user.inn, +# 'erc20': user.erc20, +# }, +# )