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

Kept getting 401 error on Windows without environment variables #87

Closed
Jazzynupe opened this issue Oct 21, 2019 · 5 comments · Fixed by #88
Closed

Kept getting 401 error on Windows without environment variables #87

Jazzynupe opened this issue Oct 21, 2019 · 5 comments · Fixed by #88

Comments

@Jazzynupe
Copy link

Not sure if this should be considered an issue or note for the developers/contributors to update the docs

I kept trying to connect to the LFS test server that was running when I had NO environment variables set and I kept getting a 401 error no matter what I did.

PS H> .\LFS-Server-Latest.exe 
2019-10-21T18:06:44Z localhost lfs[21736] [proc.go:203]: version=0.4.0 fn=main msg=listening 
pid=21736 addr=tcp://:8080
2019-10-21T18:07:41Z localhost lfs[21736] [server.go:659]: url=/mgmt status=404 
request_id=c396f405-09e1-a7a8-3080-2ca6b8811b12 method=GET
2019-10-21T18:08:17Z localhost lfs[21736] [server.go:659]: method=POST url=/objects/batch 
status=401 request_id=53c1c8a3-8cb8-4638-e8cb-71a2b5be96ca
2019-10-21T18:08:18Z localhost lfs[21736] [server.go:659]: method=POST url=/objects/batch 
status=401 request_id=b6ab17c1-f61b-2b7e-dd44-ad97b25ff00f
2019-10-21T18:08:20Z localhost lfs[21736] [server.go:659]: method=POST url=/objects/batch 
status=401 request_id=63402406-fc3d-655d-23d6-662d445e29a9
OST url=/objects/batch status=401                                                                              `

After setting the following in PowerShell and running it finally was successful and showed a management interface as expected. So without those variables even the default didn't seem to work properly

set-item env:\LFS_HOST -Value "localhost:8080"
set-item env:\LFS_ADMINUSER -Value "unset"
set-item env:\LFS_ADMINPASS -Value "unset"
set-item env:\LFS_SCHEME -Value "http"
.\LFS-Server-Latest.exe
@bk2204
Copy link
Member

bk2204 commented Oct 21, 2019

Hey,

Sorry to hear you've been having trouble. In the README, I see the following text:

If the LFS_ADMINUSER and LFS_ADMINPASS variables are set, a rudimentary admin interface can be accessed via http://$LFS_HOST/mgmt. Here you can add and remove users.

It seems to me that may be a little terse to explain things well, but I read it that you would need to set those options to enable the management interface, and therefore implicitly to create users. Can you help me understand a little bit better where your understanding differs so we can update things to be clearer?

@Jazzynupe
Copy link
Author

Well what I was expecting was to be able to use the sample server by just running it with the default credentials.

So passing the default admin and password it should have taken requests for me to do some testing. However this did not work at all and I just got the 401 error message.

I added the environment variables and bingo everything just worked. I thought that the environment variables would only be required if I wanted to customize something about the default server. The readme seems to indicate that it would work without these variables.

Someone new to LFS Server sample might assume that it should work without these settings.

@bk2204
Copy link
Member

bk2204 commented Oct 21, 2019

I don't think there are any default credentials, and I think that's by design, from looking at the code. It looks like you may have been expecting the literal string "unset", but I believe the README means to say that no credentials are set if you don't provide an environment variable.

@Jazzynupe
Copy link
Author

Right and I think that is where the confusion comes from. If I just wanted to do a quick install test I would run with all the defaults before I configured it. When I saw "unset" I thought literally. The readme/examples just could be clarified I think to know that these values MUST be set before it can be used (or marked as REQUIRED).

LFS_ADMINUSER   # An administrator username, default: unset
LFS_ADMINPASS   # An administrator password, default: unset
``

@bk2204
Copy link
Member

bk2204 commented Oct 21, 2019

Okay, I think I understand better where the problem is. It's completely possible to run with the management interface disabled, but it will need to have been run once to create users in the first place. I'll open a PR to improve the text.

@bk2204 bk2204 mentioned this issue Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants