Skip to content
This repository was archived by the owner on Dec 21, 2019. It is now read-only.

Filebased backend#36

Open
trusch wants to merge 2 commits into
apexskier:masterfrom
trusch:master
Open

Filebased backend#36
trusch wants to merge 2 commits into
apexskier:masterfrom
trusch:master

Conversation

@trusch
Copy link
Copy Markdown

@trusch trusch commented Dec 12, 2016

Someone pullrequested this to my fork. I reviewed and accepted it, so here it goes upstream.

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 12, 2016

Coverage Status

Changes Unknown when pulling 9f2057e on trusch:master into ** on apexskier:master**.

@apexskier
Copy link
Copy Markdown
Owner

Thanks! I see a couple small things I'd like to tweak. @trusch don't worry about making changes since you're just forwarding this along, but @brainm if you want to address any of this go ahead. If not I'll get to this at some point

Comment thread fileBackend.go
@@ -0,0 +1,92 @@
package httpauth
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Add a docstring describing why this backend is useful

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Human readable, file based backend

Comment thread fileBackend_test.go
}
file.Write(data)
file.Close()
//
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

useless comment

Comment thread fileBackend.go
return b.save()
}

func (b FileAuthBackend) Close() {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

add a comment explaining why this is a no-op

Comment thread fileBackend.go
file, err := os.OpenFile(b.filepath,os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
defer file.Close()
if err != nil {
fmt.Printf("==>%v",err)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

remove debugging comment

Comment thread fileBackend.go
func (b FileAuthBackend) SaveUser(user UserData) error {
b.users[user.Username] = user
err := b.save()
return err
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can this just be return b.save()?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants