Can we change where op looks for .op folder?

Previous versions followed symlinks but recent versions no longer do. This means that the .op folder must be in the home directory.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • BenBen AWS Team

    Team Member

    Hi @kasey_junk

    I can confirm that recent versions cannot follow symlinks:

    [LOG] 2020/04/15 14:16:44 (ERROR) Can't continue. We can't safely access "/Users/bdw/.op" because it's a symbolic link. Replace the linked file with the original file and try again.

    I'm going to check with our development team to see if there is any way around this or another solution. Thanks!

    Ben

  • BenBen AWS Team

    Team Member

    I just spoke with development and it seems op should be obeying the XDG_CONFIG_HOME environment variable. Could you please try setting that to the path where you'd like op to look?

    Thanks!

    Ben

  • That does not appear to work. I set that environment variable and specified a signin for an account stored in a config in the directory I set in the environment variable. It did not work.

  • felix_1pfelix_1p

    Team Member

    Hey @kasey_junk, can you share how exactly you set the environment variable? Just to make sure that that worked correctly. At the same time I will double check that our code is correct.

  • It is respecting XDG_CONFIG_HOME, but not quite correctly. There's two problems I observed:

    1. Without XDG_CONFIG_HOME set, op is using the home directory. The standard dictates that if XDG_CONFIG_HOME is not set, ${HOME}/.config should be used as the default value of XDG_CONFIG_HOME. It says "SHOULD", but in a standard this is interpreted as "there may be a legitimate reason to ignore this, but be very careful assessing that and don't ignore this unless you have a really good reason". Or, "SHOULD" is basically "there's the odd case where this would be infeasible but it's almost a MUST" (because everyone else will assume you're doing it or clearly documenting why you aren't).
    2. With XDG_CONFIG_HOME set, op is expecting to use ${XDG_CONFIG_HOME}/.op/. This is technically allowed, I'm not aware of anything that dictates how you name your config directory, but the de facto standard is to not use a dot directory (it should use ${XDG_CONFIG_HOME}/op instead) because XDG_CONFIG_HOME is normally already hidden in the user's home directory or (like XDG_CONFIG_DIRS) is outside the user's home directory.

    Based on this, ~/.op should not be used at all, ${XDG_CONFIG_HOME} must be used if set or assumed to be ${HOME}/.config if not set, and ${XDG_CONFIG_HOME}/op should be the preferred config directory for op. What happens if someone has configuration at ~/.op or ${XDG_CONFIG_HOME}/.op isn't defined, but either migrating to ${XDG_CONFIG_HOME}/op iff that doesn't already exist or alerting the user they're using a legacy config location seem fine.

    If I could have an "op wishlist" for this, it would be:

    • 0.10.1: Print a discrete warning with every op invocation that ~/.op and ${XDG_CONFIG_HOME}/.op (iff they exist, else print nothing) are deprecated and will be moving to ${XDG_CONFIG_HOME}/op in 0.11.0.
    • Somewhere before 0.11.0: Print a big warning, optionally offer to migrate existing settings to the new location.
    • 0.11.0: Only ${XDG_CONFIG_HOME}/op is used.
  • felix_1pfelix_1p

    Team Member

    @jgoguen : Thank you for this! You are right, we are not doing a good job with how we handle XDG_CONFIG_HOME (or rather its default fallback path). I will discuss this with the team.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file