mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +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) {
|
func (d *BoltDb) GetAccessKeys(projectID int, params db.RetrieveQueryParams) ([]db.AccessKey, error) {
|
||||||
var keys []db.AccessKey
|
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
|
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 {
|
func (d *BoltDb) DeleteEnvironment(projectID int, environmentID int) error {
|
||||||
return d.deleteObject(projectID, db.EnvironmentProps, intObjectID(environmentID), nil)
|
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