forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
396 additions
and
841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package internal | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/celestiaorg/celestia-node/api/rpc/client" | ||
) | ||
|
||
const authEnvKey = "CELESTIA_NODE_AUTH_TOKEN" | ||
|
||
var ( | ||
RPCClient *client.Client | ||
RequestURL string | ||
) | ||
|
||
// InitClient creates the rpc client under the given at the *RequestURL* address | ||
func InitClient(cmd *cobra.Command, _ []string) error { | ||
var err error | ||
RPCClient, err = client.NewClient(cmd.Context(), RequestURL, os.Getenv(authEnvKey)) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// CloseClient closes the connection with the rpc client. | ||
func CloseClient(_ *cobra.Command, _ []string) { | ||
if RPCClient != nil { | ||
RPCClient.Close() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.