tech(cloudwatch): store keys in secure json blob

This commit is contained in:
bergquist 2016-11-24 14:16:52 +01:00
parent 0ea6537916
commit 3d21f06d5b
2 changed files with 13 additions and 4 deletions

View File

@ -45,8 +45,17 @@ type datasourceInfo struct {
func (req *cwRequest) GetDatasourceInfo() *datasourceInfo {
assumeRoleArn := req.DataSource.JsonData.Get("assumeRoleArn").MustString()
accessKey := req.DataSource.JsonData.Get("accessKey").MustString()
secretKey := req.DataSource.JsonData.Get("secretKey").MustString()
accessKey := ""
secretKey := ""
for key, value := range req.DataSource.SecureJsonData.Decrypt() {
if key == "accessKey" {
accessKey = value
}
if key == "secretKey" {
secretKey = value
}
}
return &datasourceInfo{
AssumeRoleArn: assumeRoleArn,

View File

@ -15,14 +15,14 @@
</div>
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "keys"'>
<label class="gf-form-label width-13">Access key</label>
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.accessKey' placeholder="default"></input>
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.secureJsonData.accessKey' placeholder="default"></input>
<info-popover mode="right-absolute">
AWS Access key id
</info-popover>
</div>
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "keys"'>
<label class="gf-form-label width-13">Secret key</label>
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.secretKey' placeholder="default"></input>
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.secureJsonData.secretKey' placeholder="default"></input>
<info-popover mode="right-absolute">
AWS Secret key
</info-popover>