dns-api: add debug endpoint
Change-Id: I7e2a6546884b43ad9b377d19b480efd52e905c32
diff --git a/core/dns-api/store.go b/core/dns-api/store.go
index 8dfd914..588a2f2 100644
--- a/core/dns-api/store.go
+++ b/core/dns-api/store.go
@@ -7,7 +7,7 @@
)
type RecordStore interface {
- Log() error
+ All() (string, error)
Add(entry, txt string) error
AddARecord(entry, ip string) error
Delete(entry, txt string) error
@@ -21,14 +21,17 @@
db string
}
-func (s *fsRecordStore) Log() error {
+func (s *fsRecordStore) All() (string, error) {
r, err := s.fs.Reader(s.db)
if err != nil {
- return err
+ return "", err
}
defer r.Close()
- _, err = io.Copy(os.Stdout, r)
- return err
+ ret, err := io.ReadAll(r)
+ if err != nil {
+ return "", err
+ }
+ return string(ret), nil
}
func (s *fsRecordStore) read() (*RecordsFile, error) {