2025-07-09 13:19:43 +01:00
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type CustomerConfig struct {
|
|
|
|
|
Project string `json:"project"`
|
|
|
|
|
CustomerDirectory string `json:"customer_directory"`
|
|
|
|
|
UIURL string `json:"ui_url"`
|
|
|
|
|
StaticURL string `json:"static_url"`
|
|
|
|
|
Port int `json:"port"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ReadCustomerConfig(path string) (CustomerConfig, error) {
|
|
|
|
|
data, err := os.ReadFile(path)
|
|
|
|
|
if err != nil {
|
2025-08-21 16:46:58 +01:00
|
|
|
return CustomerConfig{}, fmt.Errorf("failed to read customer configfile: %w", err)
|
2025-07-09 13:19:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cust CustomerConfig
|
|
|
|
|
if err := json.Unmarshal(data, &cust); err != nil {
|
|
|
|
|
return CustomerConfig{}, fmt.Errorf("failed to unmarshal JSON: %w", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cust, nil
|
|
|
|
|
}
|