tangled
alpha
login
or
join now
tjh.dev
/
test
forked from
tangled.org/core
0
fork
atom
Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork
atom
overview
issues
pulls
pipelines
appview/config: add TANGLED_DEV config
anirudh.fi
1 year ago
6d117f8c
74ac77e6
verified
This commit was signed with the committer's
known signature
.
anirudh.fi
SSH Key Fingerprint:
SHA256:cz35vdbiWEzCNEfuL9fMC2JVIhtXavXBHrRjv8gxpAk=
+12
-4
3 changed files
expand all
collapse all
unified
split
appview
config.go
state
git_http.go
signer.go
+1
appview/config.go
reviewed
···
10
10
CookieSecret string `env:"TANGLED_COOKIE_SECRET, default=00000000000000000000000000000000"`
11
11
DbPath string `env:"TANGLED_DB_PATH, default=appview.db"`
12
12
ListenAddr string `env:"TANGLED_LISTEN_ADDR, default=0.0.0.0:3000"`
13
13
+
Dev bool `env:"TANGLED_DEV, default=false"`
13
14
}
14
15
15
16
func LoadConfig(ctx context.Context) (*Config, error) {
+5
-3
appview/state/git_http.go
reviewed
···
14
14
knot := r.Context().Value("knot").(string)
15
15
repo := chi.URLParam(r, "repo")
16
16
17
17
-
// TODO: make this https for production!
18
18
-
targetURL := fmt.Sprintf("https://%s/%s/%s/info/refs?%s", knot, user.DID, repo, r.URL.RawQuery)
17
17
+
uri := "https"
18
18
+
if s.config.Dev {
19
19
+
uri = "http"
20
20
+
}
21
21
+
targetURL := fmt.Sprintf("%s://%s/%s/%s/info/refs?%s", uri, knot, user.DID, repo, r.URL.RawQuery)
19
22
resp, err := http.Get(targetURL)
20
23
if err != nil {
21
24
http.Error(w, err.Error(), http.StatusInternalServerError)
···
50
47
}
51
48
knot := r.Context().Value("knot").(string)
52
49
repo := chi.URLParam(r, "repo")
53
53
-
// TODO: make this https for production!
54
50
targetURL := fmt.Sprintf("https://%s/%s/%s/git-upload-pack?%s", knot, user.DID, repo, r.URL.RawQuery)
55
51
client := &http.Client{}
56
52
+6
-1
appview/state/signer.go
reviewed
···
9
9
"fmt"
10
10
"net/http"
11
11
"net/url"
12
12
+
"os"
12
13
"time"
13
14
)
14
15
···
42
41
},
43
42
}
44
43
45
45
-
url, err := url.Parse(fmt.Sprintf("https://%s", domain))
44
44
+
uri := "https"
45
45
+
if os.Getenv("TANGLED_DEV") == "true" {
46
46
+
uri = "http"
47
47
+
}
48
48
+
url, err := url.Parse(fmt.Sprintf("%s://%s", uri, domain))
46
49
if err != nil {
47
50
return nil, err
48
51
}