tangled
alpha
login
or
join now
zan.dev
/
core
forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
0
fork
atom
overview
issues
pulls
pipelines
appview/config: add TANGLED_DEV config
anirudh.fi
10 months ago
c2e7bdab
a4ae41d9
+12
-4
3 changed files
expand all
collapse all
unified
split
appview
config.go
state
git_http.go
signer.go
+1
appview/config.go
···
10
CookieSecret string `env:"TANGLED_COOKIE_SECRET, default=00000000000000000000000000000000"`
11
DbPath string `env:"TANGLED_DB_PATH, default=appview.db"`
12
ListenAddr string `env:"TANGLED_LISTEN_ADDR, default=0.0.0.0:3000"`
0
13
}
14
15
func LoadConfig(ctx context.Context) (*Config, error) {
···
10
CookieSecret string `env:"TANGLED_COOKIE_SECRET, default=00000000000000000000000000000000"`
11
DbPath string `env:"TANGLED_DB_PATH, default=appview.db"`
12
ListenAddr string `env:"TANGLED_LISTEN_ADDR, default=0.0.0.0:3000"`
13
+
Dev bool `env:"TANGLED_DEV, default=false"`
14
}
15
16
func LoadConfig(ctx context.Context) (*Config, error) {
+5
-3
appview/state/git_http.go
···
14
knot := r.Context().Value("knot").(string)
15
repo := chi.URLParam(r, "repo")
16
17
-
// TODO: make this https for production!
18
-
targetURL := fmt.Sprintf("https://%s/%s/%s/info/refs?%s", knot, user.DID, repo, r.URL.RawQuery)
0
0
0
19
resp, err := http.Get(targetURL)
20
if err != nil {
21
http.Error(w, err.Error(), http.StatusInternalServerError)
···
47
}
48
knot := r.Context().Value("knot").(string)
49
repo := chi.URLParam(r, "repo")
50
-
// TODO: make this https for production!
51
targetURL := fmt.Sprintf("https://%s/%s/%s/git-upload-pack?%s", knot, user.DID, repo, r.URL.RawQuery)
52
client := &http.Client{}
53
···
14
knot := r.Context().Value("knot").(string)
15
repo := chi.URLParam(r, "repo")
16
17
+
uri := "https"
18
+
if s.config.Dev {
19
+
uri = "http"
20
+
}
21
+
targetURL := fmt.Sprintf("%s://%s/%s/%s/info/refs?%s", uri, knot, user.DID, repo, r.URL.RawQuery)
22
resp, err := http.Get(targetURL)
23
if err != nil {
24
http.Error(w, err.Error(), http.StatusInternalServerError)
···
50
}
51
knot := r.Context().Value("knot").(string)
52
repo := chi.URLParam(r, "repo")
0
53
targetURL := fmt.Sprintf("https://%s/%s/%s/git-upload-pack?%s", knot, user.DID, repo, r.URL.RawQuery)
54
client := &http.Client{}
55
+6
-1
appview/state/signer.go
···
9
"fmt"
10
"net/http"
11
"net/url"
0
12
"time"
13
)
14
···
41
},
42
}
43
44
-
url, err := url.Parse(fmt.Sprintf("https://%s", domain))
0
0
0
0
45
if err != nil {
46
return nil, err
47
}
···
9
"fmt"
10
"net/http"
11
"net/url"
12
+
"os"
13
"time"
14
)
15
···
42
},
43
}
44
45
+
uri := "https"
46
+
if os.Getenv("TANGLED_DEV") == "true" {
47
+
uri = "http"
48
+
}
49
+
url, err := url.Parse(fmt.Sprintf("%s://%s", uri, domain))
50
if err != nil {
51
return nil, err
52
}