Giter VIP home page Giter VIP logo

Comments (4)

af avatar af commented on May 18, 2024

I'm +1 for this, @SimenB ?

from envalid.

SimenB avatar SimenB commented on May 18, 2024

I don't use TS, so I don't really care either way, to be honest 😛 I do think supporting the use of cleanEnv({PORT: 8080}) is useful, but maybe type correctness is more useful?

from envalid.

neezer avatar neezer commented on May 18, 2024

I do think supporting the use of cleanEnv({PORT: 8080}) is useful

This is the distinction I draw between parsing environment variables and validating generic object schemas. Since you've provided a hard-coded value of 8080, I'd argue that you're no longer parsing environment variables.

From the The Twelve-Factor App:

Apps sometimes store config as constants in the code. This is a violation of twelve-factor, which requires strict separation of config from code. Config varies substantially across deploys, code does not.

If you want a generic object validator that asserts that a property is port-like, then that could be extracted and shipped as its own module (which envalid could consume), but that should be outside the scope of cleanEnv IMO.

from envalid.

af avatar af commented on May 18, 2024

I agree, the focus of this lib is specifically for env var validation. This issue gives a very well-reasoned explanation why this is a worthwhile change, and shouldn't disrupt the existing tests. I'd be happy to merge a PR for this 👍

from envalid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.