Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 [Feature]: add envvar expose middleware #2054

Merged
merged 12 commits into from
Aug 30, 2022

Conversation

mstrYoda
Copy link
Member

Description

This pr adds environment variable expose middleware.

Fixes #2053

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • For new functionalities I follow the inspiration of the express js framework and built them similar in usage
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation - https://github.com/gofiber/docs for https://docs.gofiber.io/
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • If new dependencies exist, I have checked that they are really necessary and agreed with the maintainers/community (we want to have as few dependencies as possible)
  • I tried to make my code as fast as possible with as few allocations as possible
  • For new code I have written benchmarks so that they can be analyzed and improved

@welcome
Copy link

welcome bot commented Aug 26, 2022

Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@wangjq4214 wangjq4214 changed the title add envvar expose middleware 🚀 [Feature]: add envvar expose middleware Aug 27, 2022
@efectn
Copy link
Member

efectn commented Aug 27, 2022

Please update awesome-fiber and https://github.com/gofiber/fiber#-internal-middleware

middleware/envvar/envvar.go Outdated Show resolved Hide resolved
@mstrYoda
Copy link
Member Author

Please update awesome-fiber and https://github.com/gofiber/fiber#-internal-middleware

All done 👍

@mstrYoda mstrYoda requested a review from efectn August 27, 2022 11:51
Copy link
Member

@efectn efectn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont forget adding middleware section to other READMEs

@mstrYoda mstrYoda requested a review from efectn August 27, 2022 23:43
@efectn
Copy link
Member

efectn commented Aug 28, 2022

Check actions please. Lgtm

@mstrYoda
Copy link
Member Author

Check actions please. Lgtm

I changed t.Setenv to os.Setenv to provide backward compatibility with older Go versions.

@ReneWerner87
Copy link
Member

please check again the methods of envvar (some of them are not use and lowercase -> so not exposed )

can you please also provide a better example and link where such functionality is used in other languages or frameworks so i can better understand the use of middleware

@mstrYoda
Copy link
Member Author

please check again the methods of envvar (some of them are not use and lowercase -> so not exposed )

can you please also provide a better example and link where such functionality is used in other languages or frameworks so i can better understand the use of middleware

Well, I quickly searched but could not find an exact example of this. People are trying to reimplement their middleware/components for this work. We always wonder about our env vars that contain feature flags too in our APIs.
This is why I thought that it would be good to have built-in one.

@ReneWerner87 ReneWerner87 merged commit d9257c2 into gofiber:master Aug 30, 2022
@welcome
Copy link

welcome bot commented Aug 30, 2022

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 [Feature]: adding Environment Variable expose middleware
3 participants