Skip to content

Commit 7cdcfb3

Browse files
authored
Box connectors: now also accepts a single-line string containing the related app's private key file contents (#433)
1 parent 6315d30 commit 7cdcfb3

File tree

8 files changed

+27
-8
lines changed

8 files changed

+27
-8
lines changed

snippets/destination_connectors/box.sh.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ unstructured-ingest \
1414
--verbose \
1515
--additional-partition-args="{\"split_pdf_page\":\"true\", \"split_pdf_allow_failed\":\"true\", \"split_pdf_concurrency_level\": 15}" \
1616
box \
17-
--box-app-config $BOX_APP_CONFIG_PATH \
17+
--box-app-config $BOX_APP_CONFIG \
1818
--remote-url $BOX_REMOTE_URL
1919
```

snippets/destination_connectors/box.v1.py.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ from unstructured_ingest.runner.writers.fsspec.box import (
2424
def get_writer() -> Writer:
2525
return BoxWriter(
2626
connector_config=SimpleBoxConfig(
27-
access_config=BoxAccessConfig(box_app_config=os.getenv("BOX_APP_CONFIG_PATH")),
27+
access_config=BoxAccessConfig(box_app_config=os.getenv("BOX_APP_CONFIG")),
2828
remote_url=os.getenv("BOX_REMOTE_URL"),
2929
),
3030
write_config=BoxWriteConfig(),

snippets/destination_connectors/box.v2.py.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if __name__ == "__main__":
4242
embedder_config=EmbedderConfig(embedding_provider="huggingface"),
4343
destination_connection_config=BoxConnectionConfig(
4444
access_config=BoxAccessConfig(
45-
box_app_config=os.getenv("BOX_APP_CONFIG_PATH")
45+
box_app_config=os.getenv("BOX_APP_CONFIG")
4646
)
4747
),
4848
uploader_config=BoxUploaderConfig(

snippets/general-shared-text/box-cli-api.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ import AdditionalIngestDependencies from '/snippets/general-shared-text/ingest-d
1010

1111
The following environment variables:
1212

13-
- `BOX_APP_CONFIG_PATH` - The local path to the downloaded private key configuration JSON file for the Box Custom App, represented by `--box-app-config` (CLI) or `box_app_config` (Python).
13+
- `BOX_APP_CONFIG` - The local path to the downloaded private key configuration JSON file for the Box Custom App,
14+
or a single-line string that contains the contents of this file, represented by `--box-app-config` (CLI) or `box_app_config` (Python).
1415
- `BOX_REMOTE_URL` - The remote URL to the target folder, represented by `--remote-url` (CLI) or `remote_url` (Python).

snippets/general-shared-text/box.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,22 @@
1616
- **Share** your Box account's target folder with the copied service account's email address as a **Co-owner** or **Editor**.
1717
- Note the remote URL to the target folder, which takes the format `box://<path/to/folder/in/account>`.
1818

19-
6. The private key configuration JSON file for the Box Custom App. To download this file, in the Box Custom App, on the **Configuration** tab, under **Add and Manage Public Keys**, click **Generate a Public/Private Keypair**. Store the downloaded private key configuration JSON file in a secure location. Do not share it with others.
19+
6. The private key configuration JSON file for the Box Custom App, or a string that contains this file's contents.
20+
21+
- To download this file, in the Box Custom App, on the **Configuration** tab, under **Add and Manage Public Keys**, click **Generate a Public/Private Keypair**. Store the downloaded private key configuration JSON file in a secure location.
22+
- To ensure maximum compatibility across Unstructured service offerings, you should give the private key configuration JSON file information to Unstructured as
23+
a single-line string that contains the contents of the downloaded private key configuration JSON file (and not the file itself).
24+
To print this single-line string, suitable for copying, you can run one of the following commands from your Terminal or Command Prompt.
25+
In this command, replace `<path-to-downloaded-key-file>` with the path to the private key configuration JSON file that you downloaded by following the preceding instructions.
26+
27+
- For macOS or Linux:
28+
29+
```text
30+
tr -d '\n' < <path-to-downloaded-key-file>
31+
```
32+
33+
- For Windows:
34+
35+
```text
36+
(Get-Content -Path "<path-to-downloaded-key-file>" -Raw).Replace("`r`n", "").Replace("`n", "")
37+
```

snippets/source_connectors/box.sh.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
unstructured-ingest \
55
box \
6-
--box-app-config $BOX_APP_CONFIG_PATH \
6+
--box-app-config $BOX_APP_CONFIG \
77
--remote-url $BOX_REMOTE_URL \
88
--output-dir $LOCAL_FILE_OUTPUT_DIR \
99
--num-processes 2 \

snippets/source_connectors/box.v1.py.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if __name__ == "__main__":
2727
remote_url=os.getenv("BOX_REMOTE_URL"),
2828
recursive=True,
2929
access_config=BoxAccessConfig(
30-
box_app_config=os.getenv("BOX_APP_CONFIG_PATH")
30+
box_app_config=os.getenv("BOX_APP_CONFIG")
3131
),
3232
),
3333
)

snippets/source_connectors/box.v2.py.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if __name__ == "__main__":
2525
downloader_config=BoxDownloaderConfig(download_dir=os.getenv("LOCAL_FILE_DOWNLOAD_DIR")),
2626
source_connection_config=BoxConnectionConfig(
2727
access_config=BoxAccessConfig(
28-
box_app_config=os.getenv("BOX_APP_CONFIG_PATH")
28+
box_app_config=os.getenv("BOX_APP_CONFIG")
2929
)
3030
),
3131
partitioner_config=PartitionerConfig(

0 commit comments

Comments
 (0)