Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkChecker: How to add use password without a prompt #622

Open
alfador1 opened this issue Apr 29, 2022 · 3 comments
Open

LinkChecker: How to add use password without a prompt #622

alfador1 opened this issue Apr 29, 2022 · 3 comments

Comments

@alfador1
Copy link

Hello,

Running Linkchecker with option -p prompts to write a password.

[~/certs]$ linkchecker -u denis -p password abv.bg
INFO linkcheck.cmdline 2022-04-29 09:42:11,653 MainThread Checking intern URLs only; use --check-extern to check extern URLs.
Enter LinkChecker password for user denis at .+:

I have a very simple question.
I want to run LinkChecker in automation (Jenkins), so I don't want to provide a tty .

How can I add a password so I avoid this prompt? I don't want to create hacks to capture the input.

@cjmayo
Copy link
Contributor

cjmayo commented Apr 29, 2022

There are examples in the sample for the authentication section of linkcheckerrc:

[authentication]
# WARNING: if you store passwords in this configuration entry, make sure the
# configuration file is not readable by other users.
# Different user/password pairs for different URLs can be provided.
# Entries are a triple (URL regular expression, username, password),
# separated by whitespace.
# If the regular expression matches, the given user/password pair is used
# for authentication. The commandline options -u,-p match every link
# and therefore override the entries given here. The first match wins.
# At the moment, authentication is used for http[s] and ftp links.
#entry=
# Note that passwords are optional. If any passwords are stored here,
# this file should not readable by other users.
# ^https?://www\.example\.com/~calvin/ calvin mypass
# ^ftp://www\.example\.com/secret/ calvin

I imagine that in CI it would likely be a good idea to specify the linkcheckerrc being used with the -f option:

https://linkchecker.github.io/linkchecker/man/linkchecker.html#cmdoption-f

@alfador1
Copy link
Author

alfador1 commented May 2, 2022

I want to mention that after some digging I also found that.
I find very user unfriendly that this basic functionality must be written in configuration file, which is not by default taken in consideration. To me it ONLY worked when I specified "-f" and the path of the linkcheckerrc. Because by default configuration file is NOT in ~/.linkchecker/linkcheckerrc. So this documentation is wrong

  -f FILENAME, --config FILENAME
                        Use FILENAME as configuration file. Per default LinkChecker uses ~/.linkchecker/linkcheckerrc (under Windows %HOMEPATH%\.linkchecker\linkcheckerrc).

Please, consider allowing a simple password and username to be passed without the prompt like curl and many other comandline tools.

@cjmayo
Copy link
Contributor

cjmayo commented Aug 23, 2022

Documentation of the "new" configuration file location included in PR #632.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants