Skip to content

Pass tokens via env variable or config file #56

@sbliven

Description

@sbliven

Summary

To avoid putting tokens or credientials in scripts and jupyter notebooks, I usually parse them from a config file. It would be nice to move this code inside pyscicat.

Current behavior

Creating a ScicatClient currently requires either a token or a username/password to be supplied. Providing only the base_url results in an AssertionError.

Proposed behavior

If neither token nor credentials are supplied, read them from the following sources:

  1. $SCICAT_TOKEN environmental variable
  2. $SCICAT_USER and $SCICAT_PASSWORD
  3. The file $XDG_CONFIG_HOME/scicat/config.ini (path subject to discussion) containing either of the above variables.

For instance, I might set /.config/scicat/config.ini to the following:

SCICAT_USER = ingestor
SCICAT_PASSWORD = myp4ssw0rd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions