This commit is contained in:
sujit
2025-09-18 10:15:26 +05:45
parent 651c7335bc
commit 3606fca4ae
6 changed files with 1439 additions and 155 deletions

View File

@@ -1,11 +1,28 @@
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
)
func loadConfiguration(configPath string) (*AppConfiguration, error) {
data, err := ioutil.ReadFile(configPath)
if err != nil {
return nil, fmt.Errorf("failed to read config file: %v", err)
}
var config AppConfiguration
if err := json.Unmarshal(data, &config); err != nil {
return nil, fmt.Errorf("failed to parse JSON config: %v", err)
}
return &config, nil
}
func main() {
// Parse command line flags
configPath := flag.String("config", "sms-app.json", "Path to JSON configuration file")
@@ -16,14 +33,15 @@ func main() {
*configPath = os.Args[1]
}
// Create JSON engine
engine := NewJSONEngine()
// Load configuration
if err := engine.LoadConfiguration(*configPath); err != nil {
// Load configuration first
config, err := loadConfiguration(*configPath)
if err != nil {
log.Fatalf("Failed to load configuration: %v", err)
}
// Create JSON engine with configuration
engine := NewJSONEngine(config)
// Compile configuration
if err := engine.Compile(); err != nil {
log.Fatalf("Failed to compile configuration: %v", err)