Skip to content

Commit 3812830

Browse files
committed
Added github PAT docs
1 parent 449831f commit 3812830

File tree

6 files changed

+38
-27
lines changed

6 files changed

+38
-27
lines changed

content/docs/Actions/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ def run(dry_run, args):
2626
return ace.result("Validation failed", param_errors={"dir": "relative paths not supported"})
2727

2828
cmd_args = ["-Lla" if args.detail else "-La", args.dir]
29-
out = exec.run("ls", cmd_args)
30-
if out.error:
31-
return ace.result(out.error)
32-
return ace.result("File listing for " + args.dir, out.value)
29+
out = exec.run("ls", cmd_args).value
30+
return ace.result("File listing for " + args.dir, out)
3331

3432
app = ace.app("List Files",
3533
actions=[ace.action("List Files", "/", run, description="Show the ls -a output for specified directory")],

content/docs/App/Overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ To create an app with a custom HTML page which shows a listing of files in your
2828
load("exec.in", "exec")
2929

3030
def handler(req):
31-
ret = exec.run("ls", ["-l", "/"])
32-
if ret.error:
33-
return {"Error": ret.error, "Lines": []}
34-
return {"Error": "", "Lines": ret.value}
31+
ret = exec.run("ls", ["-l", "/"]).value
32+
return {"Error": "", "Lines": ret}
3533

3634
app = ace.app("hello4",
3735
custom_layout=True,

content/docs/Configuration/Secrets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Clace supports secret management when working with apps. Secrets can be passed t
88

99
## Supported Providers
1010

11-
Clace currently supports AWS Secrets Manager (ASM) and HashiCorp Vault as providers for secrets management. Secrets can also be read from the environment of the Clace server, which can be used in development and testing.
11+
Clace currently supports AWS Secrets Manager (ASM) and HashiCorp Vault as providers for secrets management. Secrets can also be read from the environment of the Clace server, which can be used in development and testing. Secrets can also be read from a local properties file.
1212

1313
## AWS Secrets Manager
1414

content/docs/Configuration/Security.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,44 @@ See [appsecurity]({{< ref "appsecurity" >}}) for details about the application l
7272

7373
## Private Repository Access
7474

75-
The `app create` and `app reload` commands can read public GitHub repositories. If the repository is private, to be able to access the repo, the [ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) needs to be specified. In the `clace.toml` config file, create an entry like:
75+
The `app create` and `app reload` commands can read public GitHub repositories. If the repository is private, to be able to access the repo, the [ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) or [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) needs to be specified.
76+
77+
### SSH Keys
78+
79+
For SSH key, in the `clace.toml` config file, create an entry like:
7680

7781
```toml {filename="clace.toml"}
7882
[git_auth.mykey]
79-
key_file_path = "/Users/myuser/.ssh/infoclace_rsa"
80-
password = ""
83+
key_file_path = "/Users/myuser/.ssh/id_rsa"
84+
password = "mypassphrase"
8185
```
8286

83-
`mykey` is the git auth key name, `key_file_path` points to the location of a private key file for a user with access to the repository. When running `app create`, add the `--git-auth mykey` option and use the git url instead of http url (like `git@github.com:claceio/clace.git/examples/disk_usage`). The private key specified will be used for accessing the repository. `app reload` command will automatically use the same key as specified during the create. To set the default git key to use, add in config:
87+
`mykey` is the git auth key name, `key_file_path` points to the location of a private key file for a user with access to the repository and `password` is the passphrase if any for the file.
88+
89+
{{<callout type="info" >}}
90+
Use `ssh-keygen -l -f ~/.ssh/id_rsa.pub` (on public key) to check if the fingerprint matches the SHA256 fingerprint shown at https://github.com/settings/keys. To verify the passphrase, use `ssh-keygen -y -f ~/.ssh/id_rsa` (on the private key) and type in the passphrase to check if the passphrase is correct.
91+
{{</callout>}}
92+
93+
### Personal Access Token
94+
95+
For personal access token, set
96+
97+
```toml {filename="clace.toml"}
98+
[git_auth.mypat]
99+
user_id = "myid"
100+
password = "github_pat_11A7FXXXXXXX"
101+
```
102+
103+
The `user_id` needs to be set to an non-empty value like the github id even though it is ignored for the auth.
104+
105+
When running `app create`, add `--git-auth mykey` or `--git-auth mypat` option. The private key specified will be used for accessing the repository. `app reload` command will automatically use the same key as specified during the create. To set the default git key to use, add in config:
84106

85107
```toml {filename="clace.toml"}
86108
[security]
87109
default_git_auth = "mykey"
88110
```
89111

90-
If an app has no `git_auth` set and uses a repo with git url (starts with `git@github.com:`), then the default_git_auth will be used if it is specified in the config. This git key is used for `apply` files also.
91-
92-
To change the git auth key for an app, run:
112+
This git key is used for `apply` and `sync` also. To change the git auth key for an app, run:
93113

94114
```bash
95115
clace app update-settings git-auth newkey /myapp

content/docs/Plugins/Catalog.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ All the API's support the following parameters:
4545
- **form_encoding** (string, optional) : the form encoding to use, `application/x-www-form-urlencoded` (default) or `multipart/form-data`
4646
- **json_body** (object, optional) : the object to send as json encoded body
4747
- **auth_basic** (tuple(string, string), optional): HTTP basic auth username and password
48+
- **auth_signature** (string, optional): Signature auth type
49+
- **error_on_fail** (bool, optional): Whether to fail on non-2xx status code, default true
4850

4951
The response for all API's (`value` within `plugin_response`) contains following properties:
5052

@@ -55,15 +57,10 @@ The response for all API's (`value` within `plugin_response`) contains following
5557
- **body()** (string) : the response body as a string
5658
- **json()** (object) : the response body un-marshalled as a json
5759

58-
If the API calls fails to go through then the plugin response `error` property will be set. If the API goes through, then the response `error` will not be set, even if API call fails with an HTTP error. The `status_code` will indicate whether the API succeeded on the server. To handle all possible error conditions, do (change to handle all 2xx codes if required)
60+
If the API calls fails to go through then the plugin response `error` property will be set. If the API returns non 2xx status code, error is set (unless `error_on_fail` is False). The `status_code` will indicate whether the API succeeded on the server. To make an API call and parse the response as JSON, do
5961

6062
```python {filename="app.star"}
61-
ret = http.get("http://localhost:9999/test")
62-
if ret.error or ret.value.status_code != 200:
63-
return # error handling
64-
65-
val = ret.value.json()
66-
# success handling
63+
ret = http.get("http://localhost:9999/test").value.json()
6764
```
6865

6966
## Exec Plugin

content/docs/QuickStart.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ The app defines a run handler which runs `ls` on the specified directory. The ou
9191
load ("exec.in", "exec")
9292

9393
def run(dry_run, args):
94-
out = exec.run("ls", ["-Lla"])
95-
if out.error:
96-
return ace.result(out.error)
97-
return ace.result("File listing for " + args.dir, out.value)
94+
out = exec.run("ls", ["-Lla"]).value
95+
return ace.result("File listing for " + args.dir, out)
9896

9997
app = ace.app("List Files",
10098
actions=[ace.action("List Files", "/", run, description="Show the ls -a output for specified directory")],

0 commit comments

Comments
 (0)