Skip to content

馃殌 [Feature]: add envvar expose middleware - #2054

Merged
ReneWerner87 merged 12 commits into
gofiber:masterfrom
mstrYoda:feature/envvar-middleware
Aug 30, 2022
Merged

馃殌 [Feature]: add envvar expose middleware#2054
ReneWerner87 merged 12 commits into
gofiber:masterfrom
mstrYoda:feature/envvar-middleware

Conversation

@mstrYoda

Copy link
Copy Markdown
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

welcome Bot commented Aug 26, 2022

Copy link
Copy Markdown

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

efectn commented Aug 27, 2022

Copy link
Copy Markdown
Member

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

Comment thread middleware/envvar/envvar.go Outdated
@mstrYoda

Copy link
Copy Markdown
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

@efectn efectn left a comment

Copy link
Copy Markdown
Member

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

efectn commented Aug 28, 2022

Copy link
Copy Markdown
Member

Check actions please. Lgtm

@mstrYoda

Copy link
Copy Markdown
Member Author

Check actions please. Lgtm

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

@ReneWerner87

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread middleware/envvar/envvar.go Outdated
@ReneWerner87
ReneWerner87 merged commit d9257c2 into gofiber:master Aug 30, 2022
@welcome

welcome Bot commented Aug 30, 2022

Copy link
Copy Markdown

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