keys
All checks were successful
Deploy / build (push) Successful in 46s

This commit is contained in:
Никита Круглицкий 2025-10-05 18:05:02 +06:00
parent b5091d2a16
commit 3c41b7d9a1
3 changed files with 6 additions and 6 deletions

View File

@ -1,20 +1,20 @@
import fs from 'node:fs'
import https from 'node:https' import https from 'node:https'
import path from 'node:path'
import axios from 'axios' import axios from 'axios'
import { defineEventHandler } from 'h3' import { defineEventHandler } from 'h3'
import bspbKey from '~/server/cert/pgtest_key.key?raw'
import bspbCert from '~/server/cert/pgtest_cer_2025.pem?raw'
export default defineEventHandler(async () => { export default defineEventHandler(async () => {
const merchantId = process.env.BSPB_MERCHANT_ID! const merchantId = process.env.BSPB_MERCHANT_ID!
const merchantPassword = process.env.BSPB_MERCHANT_PASSWORD! const merchantPassword = process.env.BSPB_MERCHANT_PASSWORD!
const apiUrl = process.env.BSPB_API_URL! const apiUrl = process.env.BSPB_API_URL!
const assetsStorage = useStorage('assets:server')
const bspbKey = await assetsStorage.getItem<string>('pgtest_key.key')
const bspbCert = await assetsStorage.getItem<string>('pgtest_cer_2025.pem')
const agent = new https.Agent({ const agent = new https.Agent({
key: bspbKey, key: bspbKey!,
cert: bspbCert, cert: bspbCert!,
rejectUnauthorized: false, // ⚠️ только для теста! rejectUnauthorized: false, // ⚠️ только для теста!
}) })