@eighty4/c2 0.0.2-29 → 0.0.2-30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ # Changelog
2
+
1
3
  ## [Unreleased]
2
4
 
3
5
  ### Added
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Blow up your `cloud-init` developer workflows!
4
4
 
5
+ See the [examples dir](https://github.com/eighty4/c2/tree/main/examples) for
6
+ examples running on your local machine or deploying to cloud providers.
7
+
5
8
  ## Getting started
6
9
 
7
10
  ```shell
@@ -9,7 +12,8 @@ npm i -g @eighty4/c2
9
12
  c2 -h
10
13
  ```
11
14
 
12
- (tests use `bun:test` so [install Bun](https://bun.sh/docs/installation) for contributing!)
15
+ (tests use `bun:test` so [install Bun](https://bun.sh/docs/installation)
16
+ for contributing!)
13
17
 
14
18
  ## Using the CLI program
15
19
 
@@ -30,7 +34,8 @@ const userData: string = await buildUserData('./cloud_init_dir')
30
34
 
31
35
  ## Cloud Config data dir
32
36
 
33
- Multiple user data are ordered by filenames and `01_` numbered prefixes help declare execution order.
37
+ Multiple user data are ordered by filenames and `01_` numbered prefixes help
38
+ declare execution order.
34
39
 
35
40
  ```
36
41
  ls ./cloud_init_dir
@@ -39,11 +44,13 @@ ls ./cloud_init_dir
39
44
  03_services.sh
40
45
  ```
41
46
 
42
- Shell scripts are supported as `x-shellscript` and YAML is included as `cloud-config` MIME types.
47
+ Shell scripts are supported as `x-shellscript` and YAML is included as
48
+ `cloud-config` MIME types.
43
49
 
44
50
  ## Evaluating expressions in user data
45
51
 
46
- Scripts and YAML support two template functions that can be used in expressions.
52
+ Scripts and YAML support two template functions that can be used in
53
+ expressions.
47
54
 
48
55
  ### env()
49
56
 
@@ -57,7 +64,8 @@ ENV_VAR="${{ env('LOCAL_ENV_VAR') }}"
57
64
 
58
65
  ### file()
59
66
 
60
- Looks up a file from your local filesystem and replaces the expression with its content.
67
+ Looks up a file from your local filesystem and replaces the expression with
68
+ its content.
61
69
 
62
70
  ```yaml
63
71
  #cloud-config
@@ -72,6 +80,7 @@ Relative, absolute and `~/` paths are supported.
72
80
 
73
81
  ## Contributing
74
82
 
75
- I use `c2` for initializing Debian cloud instances and locally test with QEMU and Ubuntu.
83
+ I use `c2` for initializing Debian cloud instances and locally test with QEMU
84
+ and Ubuntu.
76
85
 
77
86
  Feedback on your use cases and worfklows is greatly appreciated!
package/lib/http.ts CHANGED
@@ -29,8 +29,8 @@ async function sendUserData(res: ServerResponse, userDataDir: string) {
29
29
  const message = new MultipartMessage(
30
30
  await collectAttachments(userDataDir),
31
31
  )
32
- res.writeHead(200, message.headers)
33
- res.write(message.responseBody())
32
+ res.writeHead(200)
33
+ res.write(message.toHTTP())
34
34
  } catch (e: any) {
35
35
  console.error(500, '/user-data', e.message)
36
36
  res.writeHead(500)
package/lib_js/http.js CHANGED
@@ -25,8 +25,8 @@ export function startUserDataHttp(port, userDataDir) {
25
25
  async function sendUserData(res, userDataDir) {
26
26
  try {
27
27
  const message = new MultipartMessage(await collectAttachments(userDataDir));
28
- res.writeHead(200, message.headers);
29
- res.write(message.responseBody());
28
+ res.writeHead(200);
29
+ res.write(message.toHTTP());
30
30
  }
31
31
  catch (e) {
32
32
  console.error(500, '/user-data', e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eighty4/c2",
3
- "version": "0.0.2-29",
3
+ "version": "0.0.2-30",
4
4
  "author": "Adam McKee <adam.be.g84d@gmail.com>",
5
5
  "repository": "https://github.com/eighty4/c2",
6
6
  "homepage": "https://github.com/eighty4/c2",