1234567891011121314151617181920212223242526272829303132333435 |
- package config
- import (
- "log"
- "path/filepath"
- "github.com/ovh/go-ovh/ovh"
- )
- var OVHClient *ovh.Client
- // InitOVHClient initializes the OVH client using the configuration file
- func InitOVHClient() {
- // Get absolute path to ovh.conf in current directory
- configPath, err := filepath.Abs("./ovh.conf")
- if err != nil {
- log.Fatalf("Error getting config path: %v", err)
- }
- // Create client using config file
- client, err := ovh.NewClient(
- "ovh-eu", // Endpoint
- "", // Application key (will be loaded from config)
- "", // Application secret (will be loaded from config)
- "", // Consumer key (will be loaded from config)
- )
- log.Printf("client: %v", client)
- if err != nil {
- log.Fatalf("Error creating OVH client: %v", err)
- }
- log.Printf("OVH client initialized with config from: %s", configPath)
- OVHClient = client
- }
|