summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorgarder500 <jeremy27.clara22@gmail.com>2025-10-26 15:29:23 +0100
committergarder500 <jeremy27.clara22@gmail.com>2025-10-26 15:29:23 +0100
commitfc485c8de10e6dea63054278c8d30d24d87fd621 (patch)
treec314a952e53a819dc62a796b63e8b76cc5ee8ba4 /internal/config/config.go
parent2f3ab35c11a82a77aee77f91a83ddf9a5b6aea12 (diff)
feat: add gRPC services for User, Project, and Organization management
- Implemented UserService with methods for GetUser, CreateUser, UpdateUser, and DeleteUser. - Implemented ProjectService with methods for GetProject, CreateProject, UpdateProject, and DeleteProject. - Implemented OrganizationService with methods for GetOrganization, CreateOrganization, UpdateOrganization, and DeleteOrganization. - Defined corresponding request and response message types for each service. - Generated gRPC code from proto definitions for seamless integration.
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go62
1 files changed, 62 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index d912156..c872203 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -1 +1,63 @@
package config
+
+import (
+ "fmt"
+
+ "github.com/BurntSushi/toml"
+)
+
+// RPC holds RPC configuration
+type RPC struct {
+ RPCSecret string
+ RPCAddr string
+}
+
+// API holds API configuration
+type API struct {
+ APIAddr string
+ APIDomain string
+}
+
+// InternalDB holds internal database configuration
+type InternalDB struct {
+ Manager string
+ URI string
+}
+
+// ExternalDB holds external database configuration
+type ExternalDB struct {
+ Manager string
+ URI string
+}
+
+// Cluster holds cluster/distributed configuration
+type Cluster struct {
+ NodeID string
+ IsRPCServer bool
+ RPCServers []string
+}
+
+// Config holds the application configuration
+type Config struct {
+ Region string
+ RPC RPC
+ API API
+ InternalDB InternalDB
+ ExternalDB ExternalDB
+ Cluster Cluster
+}
+
+// LoadConfig loads configuration from a TOML file
+func LoadConfig(filePath string) (*Config, error) {
+ var config Config
+ if _, err := toml.DecodeFile(filePath, &config); err != nil {
+ return nil, fmt.Errorf("failed to decode config file: %w", err)
+ }
+
+ // Set defaults
+ if config.Region == "" {
+ config.Region = "supabase"
+ }
+
+ return &config, nil
+}