Skip to content

Conversation

shin-
Copy link
Contributor

@shin- shin- commented Oct 9, 2015

When provided, default paths (~/.docker/config.json and ~/.dockercfg) are ignored.

@shin- shin- self-assigned this Oct 9, 2015
@shin- shin- added this to the 1.6.0 milestone Oct 9, 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to make a suggestion here that I think will make it easier to test. I think the logic for "find config file" can be separated from "read contents of config file".

def find_config(config_path=None):
    for path in (
        config_path, 
        os.path.join(os.environ.get('DOCKER_CONFIG'), os.path.basename(DOCKER_CONFIG_FILENAME)),
        os.path.join(os.path.expanduser('~'), DOCKER_CONFIG_FILENAME),
        os.path.exists(os.path.join(os.path.expanduser('~'), LEGACY_DOCKER_CONFIG_FILENAME))
    ):
        if path and os.path.exists(path):
            return path

    return None

@shin- shin- force-pushed the 785-docker_config_env branch from aa4f675 to 6394a73 Compare October 10, 2015 00:11
When provided, default paths are ignored.

Signed-off-by: Joffrey F <joffrey@docker.com>
@shin- shin- force-pushed the 785-docker_config_env branch from 6394a73 to 23cf768 Compare October 10, 2015 00:15
@shin-
Copy link
Contributor Author

shin- commented Oct 10, 2015

Implemented @dnephin 's suggestions and rebased.

@dnephin
Copy link
Contributor

dnephin commented Oct 13, 2015

LGTM

shin- added a commit that referenced this pull request Oct 14, 2015
Use DOCKER_CONFIG environment variable to look up auth config
@shin- shin- merged commit baaa3e3 into master Oct 14, 2015
@shin- shin- deleted the 785-docker_config_env branch November 12, 2015 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants