bibendi / dip

The dip is a CLI dev–tool that provides native-like interaction with a Dockerized application.
MIT License
1.26k stars 44 forks source link

question regarding description string #141

Open hjw opened 2 years ago

hjw commented 2 years ago

I'd like to have my description strings be able to access environment variables. I'd also like to be able to set my other variables, like my database name.

Use case. In my dip.yml file I set a variable that compose uses, which works fine, but I'd like to be able to have the string printed with dip ls reflect that port number, and I'd like to pass in the db name to the pgsql service:

environment:     
  RAILS_ENV: development             
  EXPOSED_RAILS_PORT: 3004
  DB_NAME:my_db
<snip> 
subcommands:
      s:
        description: Run Rails server available at http://localhost:${EXPOSED_RAILS_PORT}
        service: rails
        compose:
          run_options: [service-ports, use-aliases]

  psql:
    description: Run psql console
    service: postgres
    # Because this is a rails project, the name of the database
    # (project_dev) is set in config/database.yml
    # command: env PGPASSWORD=postgres psql -h postgres -U postgres -d project_dev
    command: env PGPASSWORD=postgres psql -h postgres -U postgres -d ${DB_NAME}

This doesn't work now, I believe because the variables set under environment are only used as pass throughs to docker-compose. It would be great if I could access them in my description strings though. Any thoughts?

bibendi commented 2 years ago

Hi! Good idea. I'll add this in the next release.