Giter Club home page Giter Club logo

Comments (8)

npryce avatar npryce commented on May 22, 2024

Sounds like a good idea. Not sure about precedence. I think for safety, it should be an error (or at least a highly visible warning) if the environment variable is set and the .adr-dir file exists.

This would also address the issues raised in #51.

from adr-tools.

npryce avatar npryce commented on May 22, 2024

Thinking about this some more. Yes, an ADR_DIR environment variable sounds like a good idea (although I worry about environment variable name clash... is the name used by any other program?)

The advantage of the .adr-dir file over the environment variable is that it can be checked into version control, while the environment variable is local to each user's workstation

Precedence-wise, therefore, the .adr-dir file MUST take precedence over the environment variable, otherwise setting the environment variable would stop adr-tools working with existing projects. For the same reason, if the default ADR directory (doc/adr) already exists, that also must take precedence over the environment.

from adr-tools.

retnuh avatar retnuh commented on May 22, 2024

Isn't this a bit backwards with expectations though? One often uses an ENV var to override what's checked in of the default state; it allows easy switching of behaviour at the cli without having to edit files, move directories, etc. I think it would make sense to issue either a warning or error if there is a conflict but I would think that the main utility would be having the ADR_DIR be the highest precedence.

from adr-tools.

npryce avatar npryce commented on May 22, 2024

I'm torn... I can see one way being error prone. And the other way being unusual (and therefore error prone in different ways).

A design goal is that all project config can be checked into version control. Maybe the conflict here is because an environment variable works against that goal.

from adr-tools.

retnuh avatar retnuh commented on May 22, 2024

Looking back at original use case reported in the issue, I think your first response makes the most sense - warn/puke if env var exists as well as .adr-dir and they don't match. Could also have a flag to suppress the warning/error.

If I had to guess, people will use it in an either-or sort of way - either have a checked in .adr-dir file, or use ENV vars to switch/specify based on their own custom setups. The appropriate documentation could even be written to suggest that users pick one way or the other, perhaps?

from adr-tools.

npryce avatar npryce commented on May 22, 2024

I think the rules should be the following pseudocode:

if ADR_DIR is set
    if .adr-exists and the contents is different than $ADR_DIR or the directory doc/adr exists and $ADR_DIR != "doc/adr" then
        fail
    else
        use $ADR_DIR
    end
else
    ... current behaviour
end

from adr-tools.

npryce avatar npryce commented on May 22, 2024

This can easily be implemented by adding logic to the _adr_dir script.

from adr-tools.

bcolferzd avatar bcolferzd commented on May 22, 2024

from adr-tools.

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.