# Better config/version.rb handling and loading more variables from it

**URL:** <https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252>\
**Category:** Development\
**Created:** [2017年八月17日 16:22 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252 "2017-08-17T16:22:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)\
**Post date:** [2017年八月17日 16:22 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/1 "2017-08-17T16:22:01Z")

</div>

I run my discourse instance from an rpm instead of git. that means may parts of discourse that try to find out the version from git fail in my installation. while investigating this i noticed that there is already code to load the version information from a file. But that code had a lot of duplicates. So i moved the common code into a function and then added another function to return the full git describe string.

Would this patch be acceptable?

> <https://gist.github.com/darix/4c6ba244186a6634be1ac6f0adf77f0a>

---

<div class="post-metadata">

**Author:** ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)\
**Post date:** [2017年八月18日 13:33 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/2 "2017-08-18T13:33:30Z")

</div>

Does the patch need any improvements or is it ok as is?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2017年八月18日 14:23 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/3 "2017-08-18T14:23:18Z")

</div>

In principle I am ok with it just worried it may break CI or plugin UI

---

<div class="post-metadata">

**Author:** ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)\
**Post date:** [2017年八月18日 14:40 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/4 "2017-08-18T14:40:11Z")

</div>

code flow should be the same still.i also tested without config/version.rb and only some values set i config/version.rb.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2017年八月18日 14:42 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/5 "2017-08-18T14:42:15Z")

</div>

Send thorough a PR we can have a look

---

<div class="post-metadata">

**Author:** ![darix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darix/32/114280_2.png) [@darix](https://meta.discourse.org/u/darix)\
**Post date:** [2017年八月18日 14:58 UTC](https://meta.discourse.org/t/better-config-version-rb-handling-and-loading-more-variables-from-it/68252/6 "2017-08-18T14:58:21Z")

</div>

[https://github.com/discourse/discourse/pull/5061](https://github.com/discourse/discourse/pull/5061)
