# \<Ruby\> Use StaticDate and Time for Dev Env and CurrentDateTime for Prod Env

**URL:** <https://discuss.elastic.co/t/ruby-use-staticdate-and-time-for-dev-env-and-currentdatetime-for-prod-env/253925>\
**Category:** Logstash\
**Created:** [November 1, 2020, 5:54am UTC](https://discuss.elastic.co/t/ruby-use-staticdate-and-time-for-dev-env-and-currentdatetime-for-prod-env/253925 "2020-11-01T05:54:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mastersmit](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mastersmit](https://discuss.elastic.co/u/mastersmit)\
**Post date:** [November 1, 2020, 5:54am UTC](https://discuss.elastic.co/t/ruby-use-staticdate-and-time-for-dev-env-and-currentdatetime-for-prod-env/253925/1 "2020-11-01T05:54:01Z")

</div>

I have a requirement where I need to use specific date/time for a testing at Ruby scripts and not at Logstash level. Is there a way i could stub those value?

Currently I am using the enviorment variable to check if it is `test` then use `x` date if not then use current datetime.

Is there a better way to configure logstash for different env.

---

<div class="post-metadata">

**Author:** ![mastersmit](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mastersmit](https://discuss.elastic.co/u/mastersmit)\
**Post date:** [November 1, 2020, 3:29pm UTC](https://discuss.elastic.co/t/ruby-use-staticdate-and-time-for-dev-env-and-currentdatetime-for-prod-env/253925/2 "2020-11-01T15:29:01Z")

</div>

Here is the solution, to the problem i was actually looking for

> <https://github.com/shah-smit/observability-spring-demo/issues/8>
>
> https://dev.to/exampro/testunit-writing-test-code-in-ruby-part-1-of-3-44m2

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2020, 3:29pm UTC](https://discuss.elastic.co/t/ruby-use-staticdate-and-time-for-dev-env-and-currentdatetime-for-prod-env/253925/3 "2020-11-29T15:29:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
