# Retrieve Gateway settings from Module Custom Function

**URL:** <https://forum.inductiveautomation.com/t/retrieve-gateway-settings-from-module-custom-function/83587>\
**Category:** Module Development\
**Created:** [December 28, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/retrieve-gateway-settings-from-module-custom-function/83587 "2023-12-28T21:20:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subin\_Adhikari](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Subin\_Adhikari](https://forum.inductiveautomation.com/u/Subin_Adhikari)\
**Post date:** [December 28, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/retrieve-gateway-settings-from-module-custom-function/83587/1 "2023-12-28T21:20:11Z")

</div>

Gurus,

1. I've used ignition-module-tools to boilerplate my module (this is my 1st ever module in Ignition),
2. with the help of the Gateway Webpage (Home Connect) Example, I was able to have a settings page for my module.
3. I've played around scripting-function ( SDK Example ) and was successful to hook my needed function to my designer and through RPC I am able to invoke my gateway function from the designer.
4. I see that Gateway Context must be injected to retrieve my settings ( please correct me if my understanding is wrong )
5. 

> APISettingsRecord thatOneRecord = context.getLocalPersistenceInterface().find(APISettingsRecord.META, 0L);

how do I inject Gateway Context or what are the possible path/s I can retrieve my module gateway settings?

Thank you for your help and cooperation as usual

Regards.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 28, 2023, 9:25pm UTC](https://forum.inductiveautomation.com/t/retrieve-gateway-settings-from-module-custom-function/83587/2 "2023-12-28T21:25:04Z")

</div>

Your module is given a gateway context during setup. You need to capture that and provide it to all of the pieces of your module that need it. Using a static field, typically with a static getter method, is common.

---

<div class="post-metadata">

**Author:** ![Subin\_Adhikari](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Subin\_Adhikari](https://forum.inductiveautomation.com/u/Subin_Adhikari)\
**Post date:** [December 28, 2023, 9:48pm UTC](https://forum.inductiveautomation.com/t/retrieve-gateway-settings-from-module-custom-function/83587/3 "2023-12-28T21:48:18Z")

</div>

Thanks for enlightening here, appreciated.
