Compare commits
No commits in common. "2323810b06ad57771c05341a199158d5ebaf9a10" and "3d2238568964bac103c0c5bac61c67cc39ce256a" have entirely different histories.
2323810b06
...
3d22385689
5 changed files with 1 additions and 11 deletions
|
@ -36,7 +36,6 @@ public class Config
|
||||||
public class DatabaseConfig
|
public class DatabaseConfig
|
||||||
{
|
{
|
||||||
public string Url { get; init; } = string.Empty;
|
public string Url { get; init; } = string.Empty;
|
||||||
public bool? EnablePooling { get; init; }
|
|
||||||
public int? Timeout { get; init; }
|
public int? Timeout { get; init; }
|
||||||
public int? MaxPoolSize { get; init; }
|
public int? MaxPoolSize { get; init; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ public class DatabaseContext : DbContext
|
||||||
{
|
{
|
||||||
var connString = new NpgsqlConnectionStringBuilder(config.Database.Url)
|
var connString = new NpgsqlConnectionStringBuilder(config.Database.Url)
|
||||||
{
|
{
|
||||||
Pooling = config.Database.EnablePooling ?? true,
|
|
||||||
Timeout = config.Database.Timeout ?? 5,
|
Timeout = config.Database.Timeout ?? 5,
|
||||||
MaxPoolSize = config.Database.MaxPoolSize ?? 50,
|
MaxPoolSize = config.Database.MaxPoolSize ?? 50,
|
||||||
MinPoolSize = 0,
|
MinPoolSize = 0,
|
||||||
|
|
|
@ -30,8 +30,6 @@ MetricsPort = 5001
|
||||||
[Database]
|
[Database]
|
||||||
; The database URL in ADO.NET format.
|
; The database URL in ADO.NET format.
|
||||||
Url = "Host=localhost;Database=foxnouns_net;Username=pronouns;Password=pronouns"
|
Url = "Host=localhost;Database=foxnouns_net;Username=pronouns;Password=pronouns"
|
||||||
; Whether to enable connection pooling. This should be turned off if using pgbouncer. Defaults to true.
|
|
||||||
EnablePooling = true
|
|
||||||
; The timeout for opening new connections. Defaults to 5.
|
; The timeout for opening new connections. Defaults to 5.
|
||||||
Timeout = 5
|
Timeout = 5
|
||||||
; The maximum number of open connections. Defaults to 50.
|
; The maximum number of open connections. Defaults to 50.
|
||||||
|
|
|
@ -25,7 +25,6 @@ type Handler struct {
|
||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
ProxyTarget string `json:"proxy_target"`
|
ProxyTarget string `json:"proxy_target"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
PoweredBy string `json:"powered_by"`
|
|
||||||
|
|
||||||
limiter *Limiter
|
limiter *Limiter
|
||||||
proxy *httputil.ReverseProxy
|
proxy *httputil.ReverseProxy
|
||||||
|
@ -33,10 +32,6 @@ type Handler struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hn *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (hn *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
if hn.PoweredBy != "" {
|
|
||||||
w.Header().Set("X-Powered-By", hn.PoweredBy)
|
|
||||||
}
|
|
||||||
|
|
||||||
// all public api endpoints are prefixed with this
|
// all public api endpoints are prefixed with this
|
||||||
if !strings.HasPrefix(r.URL.Path, "/api/v2") {
|
if !strings.HasPrefix(r.URL.Path, "/api/v2") {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"port": 5003,
|
"port": 5003,
|
||||||
"proxy_target": "http://localhost:5000",
|
"proxy_target": "http://localhost:5000",
|
||||||
"debug": true,
|
"debug": true
|
||||||
"powered_by": "5 gay rats"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue