/** * SmtpService - smtpservice * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2026 */ package main import ( "net/http" "github.com/gin-gonic/gin" ) func ReadSecret(cfg ConfigServiceConfig) gin.HandlerFunc { return func(c *gin.Context) { var secretName = c.Param("secretname") if secretName == "" { c.JSONP(http.StatusCreated, gin.H{"error": "missing secret param", "status": "error"}) } password, ko := GetPassword(cfg.KeepassKeyStoreFile, cfg.KeepassSecretKeyFile, secretName) if ko { c.JSONP(http.StatusCreated, gin.H{"error": "secret not found", "status": "error"}) return } c.JSONP(http.StatusCreated, gin.H{"secret": secretName, "value": password}) } }