# Passing environment variable from Apollo Router to Rhai Script

**URL:** <https://community.apollographql.com/t/passing-environment-variable-from-apollo-router-to-rhai-script/5726>\
**Category:** Router\
**Tags:** server, router, rhai\
**Created:** [February 15, 2023, 10:49am UTC](https://community.apollographql.com/t/passing-environment-variable-from-apollo-router-to-rhai-script/5726 "2023-02-15T10:49:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taingk](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/taingk/32/3888_2.png) [@taingk](https://community.apollographql.com/u/taingk)\
**Post date:** [February 15, 2023, 10:49am UTC](https://community.apollographql.com/t/passing-environment-variable-from-apollo-router-to-rhai-script/5726/1 "2023-02-15T10:49:28Z")

</div>

Hello all,

I am currently migrating from Apollo Gateway to Apollo Router and I need to re-develop all the plugins we made in typescript to rhai script.

The challenge is interesting and I managed to do most of the work but I could not find my answer to how should I pass environment variable from Apollo Router to my rhai scripts ?  
Should I make a custom router and make all the plugins from scratch with Rust, then pass the env var through the router config file ?

Doing rhai script is fine, but I do not want to explore Rust since it seems to be more complex, especially if it’s just for env var…

Thanks in advance !

---

<div class="post-metadata">

**Author:** ![watson](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/watson/32/2053_2.png) [@watson](https://community.apollographql.com/u/watson)\
**Post date:** [February 17, 2023, 4:45pm UTC](https://community.apollographql.com/t/passing-environment-variable-from-apollo-router-to-rhai-script/5726/2 "2023-02-17T16:45:32Z")

</div>

Hey @taingk , we have this logged as a feature request on our end and you can track it in [this GitHub issue](https://github.com/apollographql/router/issues/1744).
