Skip to content

Commit

Permalink
Merge branch 'storage-hash' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored May 20, 2024
2 parents 465da1f + fdae925 commit 0677c55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions quackpipe.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"crypto/sha256"
"bufio"
"database/sql"
_ "embed"
Expand Down Expand Up @@ -334,6 +335,14 @@ func main() {
if r.URL.Query().Get("default_params") != "" {
default_params = r.URL.Query().Get("default_params")
}
// auth to hash based temp file storage
username, password, ok := r.BasicAuth()
if ok && len(password) > 0 {
hash := sha256.Sum256([]byte(username + password))
hashdb, _ := fmt.Printf("/tmp/%x.db", hash)
repath := regexp.MustCompile(`(.*?)\?`)
default_params = repath.ReplaceAllString(default_params, repath+"?")
}
// extract FORMAT from query and override the current `default_format`
cleanquery, format := extractAndRemoveFormat(query)
if len(format) > 0 {
Expand Down

0 comments on commit 0677c55

Please sign in to comment.