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

docs: adding reference guide #144

Merged
merged 2 commits into from
Jul 31, 2023
Merged

docs: adding reference guide #144

merged 2 commits into from
Jul 31, 2023

Conversation

lirantal
Copy link
Contributor

@lirantal lirantal commented Dec 25, 2022

Adding a section to list helpful resource guides to get started with building with env-schema

Fixes #142

Checklist

adding a section to list helpful resource guides to get started with building with env-schema
@mcollina
Copy link
Member

Could you split creation of the Fastify application with the call to listen in two files, as this enables testing without using globals?

@lirantal
Copy link
Contributor Author

Sure thing. I was going for simplicity there but have merged a PR to change that to a more modular structure: lirantal/fastify-dotenv-envschema-example#1 (landed in main already)

README.md Outdated Show resolved Hide resolved
Co-authored-by: Frazer Smith <[email protected]>
Copy link
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

Shouldn't it place in @fastify/env when you did not directly using env-schema?

@lirantal
Copy link
Contributor Author

It's a good question and I was asking myself the same thing but I thought the ideal place is here because folks using the @fastify/env plugin would probably already know best practices and how to use it, yet new folks landing on this repository might look for how to get started and how they can use env-schema, especially since it doesn't have anything to do with Fastify as the app framework itself, but just happens to live on this org.

So, I'd keep it here to be more helpful but happy to move elsewhere if you think it'd be a better fit.

@mcollina
Copy link
Member

I personally find env-schema better and I don't use fastify-env ;).

@lirantal
Copy link
Contributor Author

fastify-env is pretty small and is anyway just a wrapper around env-schema though, isn't it? I figured if you don't use fastify-env you probably just do the same plugging wrapping yourself.

@mcollina
Copy link
Member

I tend to not wrap this into a plugin, but rather read it before Fastify is started. In this way I can customize the options of Fastify itself

@jsumners
Copy link
Member

I tend to not wrap this into a plugin, but rather read it before Fastify is started. In this way I can customize the options of Fastify itself

Agreed. I really don't understand the point of fastify-env.

'use strict'

const dotenv = require('dotenv')
const config = dotenv.config()

const fastify = require('fastify')({ /* use stuff from config */})
fastify.decorate('env', {
  getter() { return config }
})

@Fdawgs Fdawgs requested a review from mcollina July 29, 2023 08:07
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 96535da into fastify:master Jul 31, 2023
bodinsamuel pushed a commit to specfy/specfy that referenced this pull request Nov 3, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [env-schema](https://togithub.com/fastify/env-schema) | [`5.2.0` ->
`5.2.1`](https://renovatebot.com/diffs/npm/env-schema/5.2.0/5.2.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/env-schema/5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/env-schema/5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/env-schema/5.2.0/5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/env-schema/5.2.0/5.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/env-schema (env-schema)</summary>

###
[`v5.2.1`](https://togithub.com/fastify/env-schema/releases/tag/v5.2.1)

[Compare
Source](https://togithub.com/fastify/env-schema/compare/v5.2.0...v5.2.1)

#### What's Changed

- chore(deps-dev): bump tsd from 0.24.1 to 0.25.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#140
- chore(deps): bump dotenv-expand from 9.0.0 to 10.0.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#141
- chore(.gitignore): add clinic by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#145
- chore(.gitignore): add bun lockfile by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#147
- chore(deps-dev): bump tsd from 0.25.0 to 0.26.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#148
- docs: Resolve the issue
[#&#8203;146](https://togithub.com/fastify/env-schema/issues/146). by
[@&#8203;aderchox](https://togithub.com/aderchox) in
[fastify/env-schema#149
- chore(deps-dev): bump tsd from 0.26.1 to 0.27.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#150
- chore(deps-dev): bump tsd from 0.27.0 to 0.28.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#151
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.25.24 to 0.26.5 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#152
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.26.8 to 0.27.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#153
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.27.8 to 0.28.5 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#154
- ci: only trigger on pushes to main branches by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#155
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.28.20 to 0.29.1 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#156
- docs: update README with section about data loading order by
[@&#8203;lirantal](https://togithub.com/lirantal) in
[fastify/env-schema#158
- docs: adding reference guide by
[@&#8203;lirantal](https://togithub.com/lirantal) in
[fastify/env-schema#144
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.29.6 to 0.30.4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#159
- chore(deps-dev): bump
[@&#8203;sinclair/typebox](https://togithub.com/sinclair/typebox) from
0.30.4 to 0.31.1 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#160
- chore(deps-dev): bump tsd from 0.28.1 to 0.29.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/env-schema#161
- test: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#162
- chore: add `.gitattributes` file by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#164
- refactor(index): use object destructuring by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#165
- refactor(index): use `TypeError` over `Error` by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#166
- test(fluent-schema): optimize split param by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/env-schema#167
- fix: correct expandEnv bug when passing in a new object in the data
option by [@&#8203;serdnam](https://togithub.com/serdnam) in
[fastify/env-schema#168

#### New Contributors

- [@&#8203;aderchox](https://togithub.com/aderchox) made their first
contribution in
[fastify/env-schema#149
- [@&#8203;lirantal](https://togithub.com/lirantal) made their first
contribution in
[fastify/env-schema#158
- [@&#8203;serdnam](https://togithub.com/serdnam) made their first
contribution in
[fastify/env-schema#168

**Full Changelog**:
fastify/env-schema@v5.2.0...v5.2.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm every weekday" in timezone
Europe/Paris, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/specfy/specfy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6ImNob3JlL3Jlbm92YXRlQmFzZUJyYW5jaCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A demo application with env-schema for reference - should we mention anywhere here to help others?
5 participants