How to use target as variable

Have two step similar deploy option,one in staging env,the other in production,only difference is host ip,how to use one single step replace two steps.

  - name: deploy1
    image: appleboy/drone-ssh
    settings:
      host: host-ip-1
      port: 22
      username: 
        from_secret: staging_env_user
      password:
        from_secret: staging_env_pass
      script:
        - do sth
    when:
      target: 
        - staging

  - name: deploy2
    image: appleboy/drone-ssh
    settings:
      host: host-ip-2
      port: 22
      username: 
        from_secret: staging_env_user
      password:
        from_secret: staging_env_pass
      script:
        - do sth
    when:
      target: 
        - production

I can’t find target as env variable by docs,what i expect something like this

  - name: deploy
    image: appleboy/drone-ssh
    settings:
      host: ${${target}_ip}     #------->here
      port: 22
      username: 
        from_secret: staging_env_user
      password:
        from_secret: staging_env_pass
      script:
        - do sth
    when:
      target: 
        - staging
        - production

and just define $staging_ip and $production_ip somewhere

any help

drone supports environment substitution:
https://docs.drone.io/pipeline/environment/substitution/
https://docs.drone.io/pipeline/environment/reference/