Giter VIP home page Giter VIP logo

Comments (4)

danmx avatar danmx commented on May 17, 2024 1

As a user I wouldn't like to have a tool rewriting my config unless I explicitly ask it to do it. I consider configs an addition to a default configuration, something that allows me to personalise the experience. I shouldn't be forced to fill all the fields of a config file. In general in config files you put only things that you want to change so if the config is a valid JSON, but empty or with some fields missing, it should be fine.

from binserve.

mufeedvh avatar mufeedvh commented on May 17, 2024

Thank You @danmx for raising this issue. The bug is valid but why would a user empty/break their configuration file? If the configuration file isn't valid, binserve shouldn't run but I definitely agree that it must respond with an error message rather than panicking.

I will implement a feature where it will rewrite the configuration to secure defaults when it's malformed and exit with a non-zero status code in the next release. 👍

Also, if anybody else wants to get it done sooner:

Write a default JSON schema for the configuration file and compare the input JSON if it matches the scheme or not. You can achieve this with valico.

All the configuration related functions and features are in the config.rs file.

📚 Resources:

from binserve.

mufeedvh avatar mufeedvh commented on May 17, 2024

Yeah, I agree, that seems like the ideal implementation! This would require some work but I will definitely implement this in the next release. 👍

There is a required fields option in the valico library:

"required": [ ]

I will put the required fields in that and omit the optional ones and proceed to serve. Thank You for the suggestion! ❤️👍

from binserve.

mufeedvh avatar mufeedvh commented on May 17, 2024

This has been fixed!

v0.2.0 Released! 🎉

from binserve.

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.