Git Product home page Git Product logo

Comments (2)

blurgyy avatar blurgyy commented on July 17, 2024 1

Hi @etdr, the use case you mentioned is quite common and currently the aliasing method is indeed the only way to come around this, your environment variable solution is a good suggestion.

I'm now thinking of letting dt-cli try to read a DT_CLI_CONFIG_PATH variable from its running env to determine its config file's path when -c is not specified, and a DT_CONFIG_DIR variable to determine a directory where the config file is searched. The expected behavior of dt-cli will be:

  1. If -c is present, ignore DT_CLI_CONFIG_PATH and DT_CONFIG_DIR
  2. If -c is not present, dt-cli will work like it is passed with -c $DT_CLI_CONFIG_PATH (if DT_CLI_CONFIG_PATH is present)
  3. Otherwise, dt-cli will try to load $DT_CONFIG_DIR/cli.toml, and $DT_CONFIG_DIR/config.toml if the cli.toml does not exist (if DT_CONFIG_DIR is present)
  4. When nothing (-c, DT_CLI_CONFIG_PATH, or DT_CONFIG_DIR) is present, dt-cli will work as before (search cli.toml and config.toml from XDG_CONFIG_HOME)

The reason I'm not using DT_CONFIG_PATH to specify path to dt-cli's config file is that there is a planned dt-server (the name is not decided and could change) utility to be provided by this project, and I would like to preserve the DT_ namespace for some shared properties between dt-cli and dt-server. In the above case, when DT_CONFIG_DIR is present, the future dt-server utility will also find its config file from there, which will be $DT_CONFIG_DIR/server.toml.

I'm certainly open to a feature that determines config path from environment variable(s)! I think it'll be included in the next release (in ~4 days) after I implement it. But if you'd like to open a pull request I'll also be happy to review and merge.

from dt.

blurgyy avatar blurgyy commented on July 17, 2024 1

Hi @etdr, this feature has been added in v0.7.5, you can now set value of DT_CLI_CONFIG_PATH to your config file, or set value of DT_CONFIG_DIR to the config file's parent directory to achieve this. E.g. DT_CLI_CONFIG_PATH=~/.path/to/file dt-cli [args].

All the best :)

from dt.

Related Issues (2)

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.