diff --git a/config.go b/pkg/gmitohtml/config.go
similarity index 78%
rename from config.go
rename to pkg/gmitohtml/config.go
index 5d26292..b4dace8 100644
--- a/config.go
+++ b/pkg/gmitohtml/config.go
@@ -1,4 +1,4 @@
-package main
+package gmitohtml
import (
"crypto/tls"
@@ -8,7 +8,6 @@ import (
"os"
"path"
- "code.rocketnine.space/tslocum/gmitohtml/pkg/gmitohtml"
"gopkg.in/yaml.v3"
)
@@ -28,7 +27,7 @@ type appConfig struct {
Certs map[string]*certConfig
}
-var config = &appConfig{
+var Config = &appConfig{
Bookmarks: make(map[string]string),
ConvertImages: false,
@@ -36,7 +35,7 @@ var config = &appConfig{
Certs: make(map[string]*certConfig),
}
-func defaultConfigPath() string {
+func DefaultConfigPath() string {
homedir, err := os.UserHomeDir()
if err == nil && homedir != "" {
return path.Join(homedir, ".config", "gmitohtml", "config.yaml")
@@ -44,7 +43,7 @@ func defaultConfigPath() string {
return ""
}
-func readconfig(configPath string) error {
+func ReadConfig(configPath string) error {
if configPath == "" {
return errors.New("file unspecified")
}
@@ -59,15 +58,15 @@ func readconfig(configPath string) error {
if err != nil {
return err
}
- config = newConfig
+ Config = newConfig
return nil
}
-func saveConfig(configPath string) error {
- config.Bookmarks = gmitohtml.GetBookmarks()
+func SaveConfig(configPath string) error {
+ Config.Bookmarks = GetBookmarks()
- out, err := yaml.Marshal(config)
+ out, err := yaml.Marshal(Config)
if err != nil {
return fmt.Errorf("failed to marshal configuration: %s", err)
}