Skip to content

Commit

Permalink
Merge pull request #25 from Sleitnick/feature/env
Browse files Browse the repository at this point in the history
Allow env variable for API key
  • Loading branch information
Sleitnick authored Feb 9, 2023
2 parents 13697e3 + 1da18c3 commit ee428fb
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 125 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
api_key.txt
test.sh
*.ai
*.psd
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rbxcloud"
version = "0.2.2"
version = "0.3.0"
description = "CLI and SDK for the Roblox Open Cloud APIs"
authors = ["Stephen Leitnick"]
license = "MIT"
Expand All @@ -12,7 +12,7 @@ edition = "2021"
[dependencies]
anyhow = "1.0.58"
base64 = "0.13.0"
clap = { version = "3.2.14", features = ["derive"] }
clap = { version = "3.2.14", features = ["derive", "env"] }
md-5 = "0.10.1"
reqwest = { version = "0.11.11", features = ["json"] }
serde = { version = "1.0.140", features = ["derive"] }
Expand Down
88 changes: 45 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
# Roblox Open Cloud CLI   ![Logo](imgs/icon_32_bottom.png)
[![CI](https://github.com/Sleitnick/rbxcloud/actions/workflows/ci.yaml/badge.svg)](https://github.com/Sleitnick/rbxcloud/actions/workflows/ci.yaml)
[![Release](https://github.com/Sleitnick/rbxcloud/actions/workflows/release.yaml/badge.svg?event=push)](https://github.com/Sleitnick/rbxcloud/actions/workflows/release.yaml)
[![Crate](https://img.shields.io/crates/v/rbxcloud.svg)](https://crates.io/crates/rbxcloud)
[![Docs](https://docs.rs/rbxcloud/badge.svg)](https://docs.rs/rbxcloud)

The `rbxcloud` CLI lets developers easily communicate with the Roblox Open Cloud APIs. The underlying library can also be used to build tools and applications that utilize the various APIs.

Possible use-cases:
- Deployment pipelines
- Live-ops
- Custom analytics
- Handling data removal requests (see [GDPR & CCPA info](https://create.roblox.com/docs/production/publishing/about-GDPR-and-CCPA))
- Debugging DataStores

## Install CLI
### Aftman
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/[email protected]
```

### From Release
Download and unzip the tool for your OS from the [releases](https://github.com/Sleitnick/rbxcloud/releases) page. You will then need to put it in your desired location and point your path variable to the executable location.

## CLI Documentation
Visit the documentation site for information on installation and usage: https://sleitnick.github.io/rbxcloud/

## Install Rust Library
### Add Dependency

To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.2.2"
```

Alternatively, use `cargo add`.
```sh
$ cargo add rbxcloud
```

See the [docs.rs](https://docs.rs/rbxcloud/latest/rbxcloud/) page for library documentation.
# Roblox Open Cloud CLI   ![Logo](imgs/icon_32_bottom.png)
[![CI](https://github.com/Sleitnick/rbxcloud/actions/workflows/ci.yaml/badge.svg)](https://github.com/Sleitnick/rbxcloud/actions/workflows/ci.yaml)
[![Release](https://github.com/Sleitnick/rbxcloud/actions/workflows/release.yaml/badge.svg?event=push)](https://github.com/Sleitnick/rbxcloud/actions/workflows/release.yaml)
[![Crate](https://img.shields.io/crates/v/rbxcloud.svg)](https://crates.io/crates/rbxcloud)
[![Docs](https://docs.rs/rbxcloud/badge.svg)](https://docs.rs/rbxcloud)

The `rbxcloud` CLI lets developers easily communicate with the Roblox Open Cloud APIs. The underlying library can also be used to build tools and applications that utilize the various APIs.

Possible use-cases:
- Deployment pipelines
- Live-ops
- Custom analytics
- Handling data removal requests (see [GDPR & CCPA info](https://create.roblox.com/docs/production/publishing/about-GDPR-and-CCPA))
- Debugging DataStores

## Install CLI
### Aftman
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/[email protected]
```

### From Release
Download and unzip the tool for your OS from the [releases](https://github.com/Sleitnick/rbxcloud/releases) page. You will then need to put it in your desired location and point your path variable to the executable location.

## CLI Documentation
Visit the documentation site for information on installation and usage: https://sleitnick.github.io/rbxcloud/

## Install Rust Library
The library built for the CLI tool is available to use directly in Rust projects. This is essentially an SDK for the Roblox Open Cloud APIs.

### Add Dependency

To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.3.0"
```

Alternatively, use `cargo add`.
```sh
$ cargo add rbxcloud
```

See the [docs.rs](https://docs.rs/rbxcloud/latest/rbxcloud/) page for library documentation.
23 changes: 23 additions & 0 deletions docs/cli/cli-api-key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# API Key
`rbxcloud` requires a Roblox API key to function. These keys can be created and managed on the [Credentials](https://create.roblox.com/credentials) Roblox page. Remember to always keep these keys secret.

Roblox API keys will auto-expire if not used for over 60 days. Use the Credentials page to regenerate the key if this occurs.

## Security
As a general rule of practice for any API key:
- Use the least number of permissions as needed
- Keep the key in a secret location (e.g. GitHub Secrets, AWS Secrets Manager, etc.)
- Never commit a key to a source code repository
- Use as strict of a CIDR as possible
- Use an expiration date to force periodic key rollovers (must be manually regenerated)

### Handling Compromised Keys
If a key is suspected to have been compromised, use the Credentials page to immediately invalidate the key. This can be done by regenerating or deleting the key. Keys can also be disabled, but re-enabling the key will not change the key, thus is not a safe option to protect from a compromised key. If in doubt, regenerate the key.

### Storing Keys
There are many tools that can be used to securely store a key. GitHub has a Secrets page for each repository, which can then be used by GitHub Actions securely. AWS and GCP have a Secrets Manager service. Azure has the Key Vault service.

If a key must be located within a local repository's directory, be sure to add it to the `.gitignore` file. This is common in some `.env` file setups.

## Environment Variable
All CLI commands expect the `--api-key` parameter, but can also be set via the `RBXCLOUD_API_KEY` environment variable. With the environment variable set, the `--api-key` parameter can be left out.
16 changes: 8 additions & 8 deletions docs/cli/cli-datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USAGE:
rbxcloud datastore list-stores [OPTIONS] --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-h, --help Print help information
-l, --limit <LIMIT> Maximum number of items to return
Expand All @@ -22,7 +22,7 @@ USAGE:
rbxcloud datastore list [OPTIONS] --datastore-name <DATASTORE_NAME> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
Expand All @@ -40,7 +40,7 @@ USAGE:
rbxcloud datastore list-versions [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --sort-order <SORT_ORDER> --limit <LIMIT> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-c, --cursor <CURSOR> Cursor for the next set of data
-d, --datastore-name <DATASTORE_NAME> DataStore name
-e, --end-time <END_TIME> End time constraint (ISO UTC Datetime)
Expand All @@ -60,7 +60,7 @@ USAGE:
rbxcloud datastore get [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
Expand All @@ -75,7 +75,7 @@ USAGE:
rbxcloud datastore set [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --data <DATA> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-D, --data <DATA> JSON-stringified data (up to 4MB)
-e, --exclusive-create Only create the entry if it does not exist
Expand All @@ -95,7 +95,7 @@ USAGE:
rbxcloud datastore increment [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --increment-by <INCREMENT_BY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --increment-by <INCREMENT_BY> The amount by which the entry should be incremented
Expand All @@ -113,7 +113,7 @@ USAGE:
rbxcloud datastore delete [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-k, --key <KEY> The key of the entry
Expand All @@ -128,7 +128,7 @@ USAGE:
rbxcloud datastore get-version [OPTIONS] --datastore-name <DATASTORE_NAME> --key <KEY> --version-id <VERSION_ID> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-d, --datastore-name <DATASTORE_NAME> DataStore name
-h, --help Print help information
-i, --version-id <VERSION_ID> The version of the key
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/cli-experience.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USAGE:
rbxcloud experience publish --filename <FILENAME> --place-id <PLACE_ID> --universe-id <UNIVERSE_ID> --version-type <VERSION_TYPE> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-f, --filename <FILENAME> Filename (full or relative) of the RBXL file
-h, --help Print help information
-p, --place-id <PLACE_ID> Place ID of the experience
Expand Down
82 changes: 41 additions & 41 deletions docs/cli/cli-install.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# Install

## Install CLI

There are a few different ways to install the `rbxcloud` CLI.

### [Aftman](https://github.com/LPGhatguy/aftman) <small>(Preferred)</small>
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/rbxcloud@0.2.2
```

Next, run `aftman install` to install `rbxcloud`.

### [Foreman](https://github.com/Roblox/foreman)
Add `rbxcloud` under the `[tools]` section of your `foreman.toml` file.
```toml
# foreman.toml
[tools]
rbxcloud = { github = "Sleitnick/rbxcloud", version = "0.2.2" }
```

Next, run `foreman install` to install `rbxcloud`.

??? info "Legacy"
Aftman is preferred over Foreman. For more information, see the [Aftman](https://github.com/LPGhatguy/aftman) GitHub repository.

### [Releases](https://github.com/Sleitnick/rbxcloud/releases)
A few prebuilt binaries are compiled and attached to each release.

1. Go to the [`releases`](https://github.com/Sleitnick/rbxcloud/releases) page
1. Navigate to the desired version (e.g. the [latest version](https://github.com/Sleitnick/rbxcloud/releases/latest))
1. Download and unzip the desired executable
1. Relocate the executable to a more permanent place
1. Change your OS path variable to point to the executable

## Verify
Run the tool with the `--version` flag to verify the installation succeeded.
```sh
$ rbxcloud --version
```
# Install

## Install CLI

There are a few different ways to install the `rbxcloud` CLI.

### [Aftman](https://github.com/LPGhatguy/aftman) <small>(Preferred)</small>
Run the `aftman add` command within your project directory. This will add `rbxcloud` to the project's `aftman.toml` file (or create one if it doesn't yet exist).
```sh
$ aftman add Sleitnick/rbxcloud@0.3.0
```

Next, run `aftman install` to install `rbxcloud`.

### [Foreman](https://github.com/Roblox/foreman)
Add `rbxcloud` under the `[tools]` section of your `foreman.toml` file.
```toml
# foreman.toml
[tools]
rbxcloud = { github = "Sleitnick/rbxcloud", version = "0.3.0" }
```

Next, run `foreman install` to install `rbxcloud`.

??? info "Legacy"
Aftman is preferred over Foreman. For more information, see the [Aftman](https://github.com/LPGhatguy/aftman) GitHub repository.

### [Releases](https://github.com/Sleitnick/rbxcloud/releases)
A few prebuilt binaries are compiled and attached to each release.

1. Go to the [`releases`](https://github.com/Sleitnick/rbxcloud/releases) page
1. Navigate to the desired version (e.g. the [latest version](https://github.com/Sleitnick/rbxcloud/releases/latest))
1. Download and unzip the desired executable
1. Relocate the executable to a more permanent place
1. Change your OS path variable to point to the executable

## Verify
Run the tool with the `--version` flag to verify the installation succeeded.
```sh
$ rbxcloud --version
```
2 changes: 1 addition & 1 deletion docs/cli/cli-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USAGE:
rbxcloud messaging publish --topic <TOPIC> --message <MESSAGE> --universe-id <UNIVERSE_ID> --api-key <API_KEY>
OPTIONS:
-a, --api-key <API_KEY> Roblox Open Cloud API Key
-a, --api-key <API_KEY> Roblox Open Cloud API Key [env: RBXCLOUD_API_KEY=]
-h, --help Print help information
-m, --message <MESSAGE> Message to send
-t, --topic <TOPIC> Message topic
Expand Down
36 changes: 18 additions & 18 deletions docs/lib/lib-install.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Rust Library Installation

## Add Dependency

To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.2.2"
```

Alternatively, use `cargo add`.
```sh
$ cargo add rbxcloud
```

## Documentation

See the [docs.rs](https://docs.rs/rbxcloud/latest/rbxcloud/) page for documentation.
# Rust Library Installation

## Add Dependency

To use `rbxcloud` in a Rust project, simply add `rbxcloud` to the `Cargo.toml` dependency list.
```toml
[dependencies]
rbxcloud = "0.3.0"
```

Alternatively, use `cargo add`.
```sh
$ cargo add rbxcloud
```

## Documentation

See the [docs.rs](https://docs.rs/rbxcloud/latest/rbxcloud/) page for documentation.
Binary file added imgs/social.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ nav:
- Home: index.md
- CLI:
- Install: cli/cli-install.md
- API Key: cli/cli-api-key.md
- Experience: cli/cli-experience.md
- Messaging: cli/cli-messaging.md
- DataStore: cli/cli-datastore.md
Expand Down
Loading

0 comments on commit ee428fb

Please sign in to comment.