Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

Commit 11ee5a8

Browse files
committed
More robust local dev experience
1 parent 422eafc commit 11ee5a8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pkg/dashboard/server/auth.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,18 @@ func getOrCreateUser(store *store.Store, scmUser *scm.User, token *login.Token)
185185
}
186186

187187
func setSessionCookie(w http.ResponseWriter, r *http.Request, user *model.User) error {
188-
fortyEightHours, _ := time.ParseDuration("48h")
189-
exp := time.Now().Add(fortyEightHours).Unix()
190-
t := token.New(token.SessToken, user.Login, "")
191-
tokenStr, err := t.SignExpires(user.Secret, exp)
188+
tokenStr, err := generateSessionCookie(user.Login, user.Secret)
192189
if err != nil {
193190
return err
194191
}
195192

196193
httputil.SetCookie(w, r, "user_sess", tokenStr)
197194
return nil
198195
}
196+
197+
func generateSessionCookie(user, secret string) (string, error) {
198+
fortyEightHours, _ := time.ParseDuration("48h")
199+
exp := time.Now().Add(fortyEightHours).Unix()
200+
t := token.New(token.SessToken, user, "")
201+
return t.SignExpires(secret, exp)
202+
}

web/src/views/envConfig/databasesTab.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export function DatabasesTab(props) {
6060
const dependency = dependencies[id]
6161
const module = dependencyCatalog.find(m => m.reference.chart.repository === dependency.chart.repository)
6262

63+
if (!module) {
64+
return null
65+
}
66+
6367
return (
6468
<div key={id} className='relative'>
6569
<button onClick={() => deleteDependency(id)} className="destructiveButtonSecondary absolute top-6 right-6">Delete</button>

0 commit comments

Comments
 (0)