File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ type Config struct {
2424type EndpointConfig struct {
2525 IP string
2626 Port string
27- // TLSEnabled specifies whether the connection is secure or not .
28- // PLEASE NOTE: it should be set to true in order to handle XTokenPath .
27+ // TLSEnabled specifies whether the connection is secure.
28+ // Must be set to true if XTokenPath is provided .
2929 TLSEnabled bool
30- // XTokenPath specifies the path to the directory with JSON file containing the X-Token for gRPC authentication.
31- // The JSON file should have a key-value pair where the key is "x-token" and the value is the authentication token.
30+ // XTokenPath specifies the path to the directory that contains a JSON file with the X-Token for gRPC authentication.
31+ // The JSON file must contain a key "x-token" with the authentication token.
3232 // If left empty, the client will not include the X-Token in its requests.
3333 XTokenPath string
3434}
@@ -79,6 +79,15 @@ func (cfg *EndpointConfig) validate() error {
7979 return fmt .Errorf ("nodebuilder/core: invalid grpc port: %s" , err .Error ())
8080 }
8181
82+ if cfg .XTokenPath != "" {
83+ if ! cfg .TLSEnabled {
84+ return fmt .Errorf ("nodebuilder/core: TLSEnabled must be true when XTokenPath is set" )
85+ }
86+ if ! utils .Exists (cfg .XTokenPath ) {
87+ return fmt .Errorf ("nodebuilder/core: XTokenPath does not exist: %s" , cfg .XTokenPath )
88+ }
89+ }
90+
8291 return nil
8392}
8493
You can’t perform that action at this time.
0 commit comments