Edits history of script submission #18615 for ' Delete environment variable (render)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Render = {
    	apiKey: string
    }
    /**
     * Delete environment variable
     * Delete a particular environment variable from a particular service.
    
    This only applies to environment variables set directly on the service, not to environment variables in a linked environment group.
    
     */
    export async function main(auth: Render, serviceId: string, envVarKey: string) {
    	const url = new URL(`https://api.render.com/v1/services/${serviceId}/env-vars/${envVarKey}`)
    
    	const response = await fetch(url, {
    		method: 'DELETE',
    		headers: {
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 235 days ago