How do i use my env variables in the code pieces?
import ObsClient from 'esdk-obs-nodejs';
const obsClient = new ObsClient({
access_key_id: process.env.OBS_ACCESS_ID,
secret_access_key: process.env.OBS_SECRET_ID,
server: process.env.OBS_SERVER
})
these wont work. and I dont want to hard code my key inside the code pieces.
Hi! Are you using docker compose to run Activepieces?
Anyways, check this: Environment Variables - Activepieces (look for the AP_EXECUTION_MODE)
And then look at this: Workers & Sandboxing - Activepieces
Maybe you wanna change to UNSANDBOXED to be able to read those env variables… I haven’t tried it tho.
yes, i am using docker-compose to run the activepieces.
I managed to achieve this by adding AP_SANDBOX_PROPAGATED_ENV_VARS
in my .env file and pass in the variables that I need. For those who’s wondering, you can refer to this : Environment Variables - Activepieces .
After that you can use the env variables in your code piece as follows:
const access_key_id= process.env.OBS_ACCESS_ID;
system
Closed
September 20, 2024, 2:19am
6
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.