# Loading our SiteSetting properties before plugin loads

**URL:** <https://meta.discourse.org/t/loading-our-sitesetting-properties-before-plugin-loads/45572>\
**Category:** Development\
**Created:** [11. Juni 2016 um 19:09 UTC](https://meta.discourse.org/t/loading-our-sitesetting-properties-before-plugin-loads/45572 "2016-06-11T19:09:02Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![def](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/def/32/120841_2.png) [@def](https://meta.discourse.org/u/def)\
**Post date:** [11. Juni 2016 um 19:09 UTC](https://meta.discourse.org/t/loading-our-sitesetting-properties-before-plugin-loads/45572/1 "2016-06-11T19:09:02Z")

</div>

I’m aware that `after_initialize` allows us to have access to the loaded properties in `SiteSetting` but I’m struggling to update my `register_middleware` method.

Since ruby isn’t my working language it’s more difficult for me to follow.

So in `lib/plugin/instance.rb` I see this may be responsible for handling the loading of our plugins.

But simplying wrapping my class in `after_initialize do` … `end` doesn’t seem to work. (Nothing appears to have loaded at all if I do that).

```
  def register_middleware(omniauth)
    omniauth.provider :steam, SiteSetting.discourse_steam_login_api_key || ENV['STEAM_WEB_API_KEY']
  end

```

Is there anything obvious I’m missing?

The problem essentially is that - when `register_middleware` is called, I don’t think my `SiteSetting` property is yet loaded.

I’ve set the `enabled_site_setting`s at the top of the file:

```
enabled_site_setting :discourse_steam_login_enabled
enabled_site_setting :discourse_steam_login_api_key

```

Some plugins only use their enabled flag, others add more properties this way. So it’s a little confusing what the purpose of `enabled_site_setting` is, some clarification on that as well if possible.

I’m hoping this is something relatively simple I’ve overlooked 😪

---

_[View the full topic](https://meta.discourse.org/t/loading-our-sitesetting-properties-before-plugin-loads/45572)._
