Hi, I'm trying to implement managementApiSecret bu...
# orm-help
j
Hi, I'm trying to implement managementApiSecret but I can't do it, I have an error : "Authentication token is invalid: 'Authorization' header not provided"
r
Hey @Jovaanc ๐Ÿ‘‹ You need to run the deployment in the following manner:
Copy code
PRISMA_MANAGEMENT_API_SECRET=secret prisma1 deploy
The env variable is required and should be the same as
managementApiSecret
.
p
can you import a secret from a .env file into the prisma.yml file? I donโ€™t want my secrets to be on github ๐Ÿ˜•
r
Yes you can. Prisma commands by default read the
.env
file. You can also specify
prisma deploy -e .something.env
to specify a different env file.
p
how do you access that info in the yml file?
r
Here's a sample
docker-compose.yml
that handles the secret:
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.34.10
    restart: always
    ports:
      - '4466:4466'
    env_file:
      - .env
    environment:
      PRISMA_CONFIG: |
        port: 4466
        managementApiSecret: ${PRISMA_MANAGEMENT_API_SECRET}
        databases:
          default:
            connector: postgres
            host: host.docker.internal
            database: prisma1
            schema: public
            user: username
            password: password
            rawAccess: true
            port: '5432'
            migrations: true
I have accessed the Management API secret in the variable above. Also the env file needs to be specified to compose.
p
sweeeeet thank you!
๐Ÿ‘ 1