Added KorAP plugin stylesheet support
Change-Id: Iaec401c59da0a2abc179f51b318c11e9fc41ce07
diff --git a/config/config.go b/config/config.go
index cdc1e0f..73e5697 100644
--- a/config/config.go
+++ b/config/config.go
@@ -13,7 +13,9 @@
const (
defaultServer = "https://korap.ids-mannheim.de/"
defaultSDK = "https://korap.ids-mannheim.de/js/korap-plugin-latest.js"
+ defaultStylesheet = "https://korap.ids-mannheim.de/css/kalamar-plugin-latest.css"
defaultServiceURL = "https://korap.ids-mannheim.de/plugin/koralmapper"
+ defaultCookieName = "km-config"
defaultPort = 5725
defaultLogLevel = "warn"
)
@@ -58,8 +60,10 @@
// MappingConfig represents the root configuration containing multiple mapping lists
type MappingConfig struct {
SDK string `yaml:"sdk,omitempty"`
+ Stylesheet string `yaml:"stylesheet,omitempty"`
Server string `yaml:"server,omitempty"`
ServiceURL string `yaml:"serviceURL,omitempty"`
+ CookieName string `yaml:"cookieName,omitempty"`
Port int `yaml:"port,omitempty"`
LogLevel string `yaml:"loglevel,omitempty"`
Lists []MappingList `yaml:"lists,omitempty"`
@@ -156,6 +160,7 @@
// Create final configuration
result := &MappingConfig{
SDK: globalConfig.SDK,
+ Stylesheet: globalConfig.Stylesheet,
Server: globalConfig.Server,
ServiceURL: globalConfig.ServiceURL,
Port: globalConfig.Port,
@@ -173,8 +178,10 @@
func ApplyDefaults(config *MappingConfig) {
defaults := map[*string]string{
&config.SDK: defaultSDK,
+ &config.Stylesheet: defaultStylesheet,
&config.Server: defaultServer,
&config.ServiceURL: defaultServiceURL,
+ &config.CookieName: defaultCookieName,
&config.LogLevel: defaultLogLevel,
}
diff --git a/config/config_test.go b/config/config_test.go
index 845ebdd..3a7ad32 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -733,6 +733,7 @@
// Check that SDK and Server are set (either from config or defaults)
assert.NotEmpty(t, config.SDK)
+ assert.NotEmpty(t, config.Stylesheet)
assert.NotEmpty(t, config.Server)
})
}
@@ -759,6 +760,7 @@
// Check that defaults are applied
assert.Equal(t, defaultSDK, config.SDK)
+ assert.Equal(t, defaultStylesheet, config.Stylesheet)
assert.Equal(t, defaultServer, config.Server)
require.Len(t, config.Lists, 1)
assert.Equal(t, "test-mapper", config.Lists[0].ID)
@@ -865,6 +867,7 @@
// Check that defaults are applied for other fields
assert.Equal(t, defaultSDK, config.SDK)
+ assert.Equal(t, defaultStylesheet, config.Stylesheet)
assert.Equal(t, defaultServer, config.Server)
assert.Equal(t, defaultServiceURL, config.ServiceURL)
}