Giter Club home page Giter Club logo

Comments (7)

Eddie023 avatar Eddie023 commented on May 30, 2024 1

Hi @dominikbraun, I would like to work on this issue.

from timetrace.

dominikbraun avatar dominikbraun commented on May 30, 2024 1

@Eddie023 Your approach is fine, but you don't even need to introduce a new userConfig file because there already is support for config.yaml:

// FromFile reads a configuration file called config.yml and returns it as a
// Config instance. If no configuration file is found, nil and no error will be
// returned. The configuration must live in one of the following directories:
//
// - /etc/timetrace
// - $HOME/.timetrace
// - .
//
// In case multiple configuration files are found, the one in the most specific
// or "closest" directory will be preferred.
func FromFile() (*Config, error) {
viper.SetConfigName("config")
viper.SetConfigType("yaml")
viper.AddConfigPath("/etc/timetrace/")
viper.AddConfigPath("$HOME/.timetrace")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
return nil, err
}
}
var config Config
if err := viper.Unmarshal(&config); err != nil {
return nil, err
}
cached = &config
return cached, nil
}

Shouldn't we give them the list of possible configurable keys? Something like timetrace config list which will return all the configurable keys and the current value. Let me know what you think. I am confused what are the configurable things currently available.

Yes. I think that this could even be done using timetrace config get without an argument. You could simply display all fields of config.Config to do so. BTW, you can get the already parsed configuration using the Timetrace.Config() function.

from timetrace.

Eddie023 avatar Eddie023 commented on May 30, 2024 1

@dominikbraun Sorry got caught up with work so working only on the weekends. I will send you draft PR by this weekend and you can decide what to do.

from timetrace.

dominikbraun avatar dominikbraun commented on May 30, 2024 1

No problem, thanks for the update! 👍

from timetrace.

Eddie023 avatar Eddie023 commented on May 30, 2024

@dominikbraun Few questions regarding this issue. Here is my approach of solving this issue. let me know what you think.

  1. Create a userConfig file in config/ dir and upon each timetrace config set <KEY> <VALUE> command upsert the KEY VALUE.
  2. If the userConfig file is available then add some functionality like merge-deep-left to override withuserConfig list.

Question:

  1. Shouldn't we give them the list of possible configurable keys? Something like timetrace config list which will return all the configurable keys and the current value. Let me know what you think. I am confused what are the configurable things currently available.

from timetrace.

dominikbraun avatar dominikbraun commented on May 30, 2024

Hi @Eddie023! Any updates on this one? If you don't have the capacities to do this issue at the moment, just let me know.

from timetrace.

Eddie023 avatar Eddie023 commented on May 30, 2024

@dominikbraun Sorry that I wasn't able to do this issue this weekend as well. Had some personal work pulling me. I don't want to extend this issue any longer so I will just unassign myself. Again, sorry for not getting this issue through.

from timetrace.

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.