mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
feat(secrets): implement secret getting for boltdb
This commit is contained in:
parent
6010665fe3
commit
891b27649e
@ -20,7 +20,10 @@ func (d *BoltDb) GetAccessKeyRefs(projectID int, accessKeyID int) (db.ObjectRefe
|
||||
|
||||
func (d *BoltDb) GetAccessKeys(projectID int, params db.RetrieveQueryParams) ([]db.AccessKey, error) {
|
||||
var keys []db.AccessKey
|
||||
err := d.getObjects(projectID, db.AccessKeyProps, params, nil, &keys)
|
||||
err := d.getObjects(projectID, db.AccessKeyProps, params, func(i interface{}) bool {
|
||||
k := i.(db.AccessKey)
|
||||
return k.EnvironmentID == nil
|
||||
}, &keys)
|
||||
return keys, err
|
||||
}
|
||||
|
||||
|
@ -40,3 +40,12 @@ func (d *BoltDb) CreateEnvironment(env db.Environment) (db.Environment, error) {
|
||||
func (d *BoltDb) DeleteEnvironment(projectID int, environmentID int) error {
|
||||
return d.deleteObject(projectID, db.EnvironmentProps, intObjectID(environmentID), nil)
|
||||
}
|
||||
|
||||
func (d *BoltDb) GetEnvironmentSecrets(projectID int, environmentID int) ([]db.AccessKey, error) {
|
||||
var keys []db.AccessKey
|
||||
err := d.getObjects(projectID, db.AccessKeyProps, db.RetrieveQueryParams{}, func(i interface{}) bool {
|
||||
k := i.(db.AccessKey)
|
||||
return k.EnvironmentID != nil && *k.EnvironmentID == environmentID
|
||||
}, &keys)
|
||||
return keys, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user