@@ -22,15 +22,19 @@ import (
22
22
)
23
23
24
24
var (
25
- cmd = flag .NewFlagSet (os .Args [0 ], flag .ExitOnError )
26
- flagCluster = cmd .String ("cluster" , "127.0.0.1" , "a comma-separated list of host:port tuples" )
27
- flagKeyspace = cmd .String ("keyspace" , "" , "keyspace to inspect" )
28
- flagPkgname = cmd .String ("pkgname" , "models" , "the name you wish to assign to your generated package" )
29
- flagOutput = cmd .String ("output" , "models" , "the name of the folder to output to" )
30
- flagUser = cmd .String ("user" , "" , "user for password authentication" )
31
- flagPassword = cmd .String ("password" , "" , "password for password authentication" )
32
- flagIgnoreNames = cmd .String ("ignore-names" , "" , "a comma-separated list of table, view or index names to ignore" )
33
- flagIgnoreIndexes = cmd .Bool ("ignore-indexes" , false , "don't generate types for indexes" )
25
+ cmd = flag .NewFlagSet (os .Args [0 ], flag .ExitOnError )
26
+ flagCluster = cmd .String ("cluster" , "127.0.0.1" , "a comma-separated list of host:port tuples" )
27
+ flagKeyspace = cmd .String ("keyspace" , "" , "keyspace to inspect" )
28
+ flagPkgname = cmd .String ("pkgname" , "models" , "the name you wish to assign to your generated package" )
29
+ flagOutput = cmd .String ("output" , "models" , "the name of the folder to output to" )
30
+ flagUser = cmd .String ("user" , "" , "user for password authentication" )
31
+ flagPassword = cmd .String ("password" , "" , "password for password authentication" )
32
+ flagIgnoreNames = cmd .String ("ignore-names" , "" , "a comma-separated list of table, view or index names to ignore" )
33
+ flagIgnoreIndexes = cmd .Bool ("ignore-indexes" , false , "don't generate types for indexes" )
34
+ flagSSLEnableHostVerification = cmd .Bool ("--ssl-enable-host-verification" , false , "don't check server ssl certificate" )
35
+ flagSSLCAPath = cmd .String ("--ssl-ca-path" , "" , "path to ssl CA certificates" )
36
+ flagSSLCertPath = cmd .String ("--ssl-cert-path" , "" , "path to ssl certificate" )
37
+ flagSSLKeyPath = cmd .String ("--ssl-key-path" , "" , "path to ssl key" )
34
38
)
35
39
36
40
//go:embed keyspace.tmpl
@@ -152,6 +156,15 @@ func createSession() (gocqlx.Session, error) {
152
156
Password : * flagPassword ,
153
157
}
154
158
}
159
+ if * flagSSLCAPath != "" || * flagSSLCertPath != "" || * flagSSLKeyPath != "" {
160
+ cluster .SslOpts = & gocql.SslOptions {
161
+ EnableHostVerification : * flagSSLEnableHostVerification ,
162
+ CaPath : * flagSSLCAPath ,
163
+ CertPath : * flagSSLCertPath ,
164
+ KeyPath : * flagSSLKeyPath ,
165
+ }
166
+ }
167
+
155
168
return gocqlx .WrapSession (cluster .CreateSession ())
156
169
}
157
170
0 commit comments