Skip to content

Conversation

@alfonsocantos
Copy link
Collaborator

No description provided.

return func(next box.H) box.H {
return func(ctx context.Context) {

if apiKey == "" && apiSecret == "" {
Copy link
Owner

@fulldump fulldump Dec 20, 2025

Choose a reason for hiding this comment

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

Why letting the user pass if no credentials?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If InceptionDB has been started without api-key then we let the user continue. Some other system will take care of this, or it is a none credentials needed scenario (testing).

It is not mandatory, as it is not in the current version.

if key != apiKey || secret != apiSecret {
w := box.GetResponse(ctx)
w.WriteHeader(http.StatusUnauthorized)
PrettyError{
Copy link
Owner

@fulldump fulldump Dec 20, 2025

Choose a reason for hiding this comment

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

No need to marshal and return response at this point. The error should be set (box SetError) so that anyone can marshal in other formats (html, json, xml...)

})
}

func (p PrettyError) MarshalTo(w io.Writer) error {
Copy link
Owner

@fulldump fulldump Dec 20, 2025

Choose a reason for hiding this comment

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

not needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agree

e.Encode(c)
}

if c.ApiKey == "" || c.ApiSecret == "" {
Copy link
Owner

@fulldump fulldump Dec 20, 2025

Choose a reason for hiding this comment

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

I wouldnt put a warning, just a log saying Auth: disabled or enabled

WithActions(
box.Get(statics.ServeStatics(staticsDir)).WithName("serveStatics"),
)
if !hideUI {
Copy link
Owner

Choose a reason for hiding this comment

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

Why hiding UI? Maybe we should allow to introduce input api-key/api-secret from the UI

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is done as well.

Copy link
Collaborator Author

@alfonsocantos alfonsocantos left a comment

Choose a reason for hiding this comment

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

I have done some of the comments.

return func(next box.H) box.H {
return func(ctx context.Context) {

if apiKey == "" && apiSecret == "" {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If InceptionDB has been started without api-key then we let the user continue. Some other system will take care of this, or it is a none credentials needed scenario (testing).

It is not mandatory, as it is not in the current version.

})
}

func (p PrettyError) MarshalTo(w io.Writer) error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agree

WithActions(
box.Get(statics.ServeStatics(staticsDir)).WithName("serveStatics"),
)
if !hideUI {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is done as well.

@alfonsocantos
Copy link
Collaborator Author

Fixing Unauthorized Error in progress...

@alfonsocantos
Copy link
Collaborator Author

done ... I guess

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 this pull request may close these issues.

2 participants