fix: add baseURL to endpoints
This commit is contained in:
parent
01285ebc9a
commit
2af4652f73
37
.air.toml
Normal file
37
.air.toml
Normal file
|
@ -0,0 +1,37 @@
|
|||
root = "."
|
||||
testdata_dir = "data"
|
||||
tmp_dir = "tmp"
|
||||
|
||||
[build]
|
||||
args_bin = []
|
||||
bin = "./tmp/main"
|
||||
cmd = "go build -o ./tmp/main ."
|
||||
delay = 1000
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||
exclude_file = []
|
||||
exclude_regex = ["_test.go"]
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
full_bin = ""
|
||||
include_dir = []
|
||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||
kill_delay = "0s"
|
||||
log = "build-errors.log"
|
||||
send_interrupt = false
|
||||
stop_on_error = true
|
||||
|
||||
[color]
|
||||
app = ""
|
||||
build = "yellow"
|
||||
main = "magenta"
|
||||
runner = "green"
|
||||
watcher = "cyan"
|
||||
|
||||
[log]
|
||||
time = false
|
||||
|
||||
[misc]
|
||||
clean_on_exit = false
|
||||
|
||||
[screen]
|
||||
clear_on_rebuild = false
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ data/
|
|||
!*.secret
|
||||
local.mk
|
||||
logzio.yml
|
||||
tmp/
|
||||
|
|
2
main.go
2
main.go
|
@ -60,7 +60,7 @@ func run(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
svc, err := msgbus.New(ctx, es)
|
||||
svc, err := msgbus.New(ctx, es, env("EV_BASE_URL", "https://ev.sour.is/inbox/"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -20,17 +21,18 @@ import (
|
|||
)
|
||||
|
||||
type service struct {
|
||||
es *es.EventStore
|
||||
baseURL string
|
||||
es *es.EventStore
|
||||
}
|
||||
|
||||
func New(ctx context.Context, es *es.EventStore) (*service, error) {
|
||||
func New(ctx context.Context, es *es.EventStore, baseURL string) (*service, error) {
|
||||
ctx, span := logz.Span(ctx)
|
||||
defer span.End()
|
||||
|
||||
if err := event.Register(ctx, &PostEvent{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &service{es}, nil
|
||||
return &service{baseURL, es}, nil
|
||||
}
|
||||
|
||||
var upgrader = websocket.Upgrader{
|
||||
|
@ -143,7 +145,7 @@ func (s *service) getUser(w http.ResponseWriter, r *http.Request) {
|
|||
Endpoint string `json:"endpoint"`
|
||||
Key string `json:"key"`
|
||||
}{
|
||||
Endpoint: a.Inbox.String(),
|
||||
Endpoint: path.Join(s.baseURL, a.Inbox.String()),
|
||||
Key: a.Pubkey.ID().String(),
|
||||
})
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user