@@ -199,10 +199,18 @@ func getConfiguration() (Config, client.Client) {
199199 }
200200
201201 config , err := ParseConfig (b )
202- if err != nil {
202+ switch {
203+ case err != nil && VenafiCloudMode && (config .OrganizationID == "" || config .ClusterID == "" ):
204+ // venafi-cloud does not require the OrganizationID or ClusterID, do not error in case they are missing
205+ case err != nil :
203206 log .Fatalf ("Failed to parse config file: %s" , err )
204207 }
205208
209+ if VenafiCloudMode {
210+ // if the venafi-cloud mode is enabled override config.Server
211+ config .Server = client .VenafiCloudProdURL
212+ }
213+
206214 baseURL := config .Server
207215 if baseURL == "" {
208216 log .Printf ("Using deprecated Endpoint configuration. User Server instead." )
@@ -274,11 +282,15 @@ func createCredentialClient(credentials client.Credentials, config Config, agent
274282 switch creds := credentials .(type ) {
275283 case * client.VenafiSvcAccountCredentials :
276284 log .Println ("Venafi Cloud mode was specified, using Venafi Service Account authentication." )
277- // check if config has Venafi Cloud data
278- if config .VenafiCloud == nil {
279- log .Fatalf ("Failed to find config for venafi-cloud: required for Venafi Cloud mode" )
285+ // check if config has Venafi Cloud data, use config data if it's present
286+ uploaderID := creds .ClientID
287+ uploadPath := ""
288+ if config .VenafiCloud != nil {
289+ log .Println ("Loading uploader_id and upload_path from \" venafi-cloud\" configuration." )
290+ uploaderID = config .VenafiCloud .UploaderID
291+ uploadPath = config .VenafiCloud .UploadPath
280292 }
281- return client .NewVenafiCloudClient (agentMetadata , creds , baseURL , config . VenafiCloud . UploaderID , config . VenafiCloud . UploadPath )
293+ return client .NewVenafiCloudClient (agentMetadata , creds , baseURL , uploaderID , uploadPath )
282294
283295 case * client.OAuthCredentials :
284296 log .Println ("A credentials file was specified, using oauth authentication." )
0 commit comments