Hi everyone! I'm a relatively new Typesense user, ...
# community-help
j
Hi everyone! I'm a relatively new Typesense user, and I'm working through deploying it with docker compose. My main issue is that I cannot figure out how to store the
--api-key
value as a secret that the compose file can pass on to the "command" to start the container. This is what many examples of a docker compose file look like:
Copy code
services:
  typesense:
    image: typesense/typesense:26.0
    restart: on-failure
    ports:
      - "8108:8108"
    volumes:
      - ./typesense-data:/data
    command: '--data-dir /data --api-key=xyz --enable-cors'
However, I do not want to hard code that
--api-key
value into my production deployment. I've tried numerous ways of passing an environment or secret variable to that
command
value of the compose file, but it seems like the value is always interpreted literally. Can anyone help me figure this out? Thank you!
j
This is a docker compose feature question, but I found this guide in their docs: https://docs.docker.com/compose/how-tos/use-secrets/
j
Ahh, figured it out. This stack overflow answer covers my issue. I didn't need the
--api-key
value available as an env var in the container, I needed it available on my host instead.
e
Was going to say, I just set TYPESENSE_API_KEY as an environment variable and it works 👍
🙏 1