Get Environment Variable with JOI

I’m using joi to structure data.
Now I’m unable to read environment variable set on startup.

I have a startup scrip.sh like:

PUBLIC_KEY="$(cat public_key.pem) docker-compose up --build"

Then I try to read that PUBLIC_KEY variable.

const envVariables = joi.object({
 PUBLIC_KEY: joi.string()
    .default('PUBLIC_KEY')
})

I thought this would automatically identify the variable but it does not.
Is it possible to get the variable set on start up with Joi?