//native
type Render = {
apiKey: string
}
/**
* Update secret files
* Replace all secret files for a service with the provided list of secret files.
**Any of the service's existing secret files not included in this request will be deleted.**
This only applies to secret files set directly on the service, not to secret files in a linked environment group.
*/
export async function main(
auth: Render,
serviceId: string,
body: { name: string; content: string }[]
) {
const url = new URL(`https://api.render.com/v1/services/${serviceId}/secret-files`)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago