This repository was archived by the owner on Aug 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_explained.html
More file actions
106 lines (104 loc) · 9.31 KB
/
Copy pathconfig_explained.html
File metadata and controls
106 lines (104 loc) · 9.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html lang="en">
<head>
<title>Newt -- config_explained</title>
<link rel="stylesheet" href="https://caltechlibrary.github.io/css/site.css">
<base href="./">
</head>
<body>
<header>
<a href="https://library.caltech.edu"><img src="https://caltechlibrary.github.io/assets/liblogo.gif" alt="Caltech Library logo"></a>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="./">README</a></li>
<li><a href="user_manual.html">User Manual</a></li>
<li><a href="LICENSE">LICENSE</a></li>
<li><a href="INSTALL.html">INSTALL</a></li>
<li><a href="about.html">About</a></li>
<li><a href="search.html">Search</a></li>
<li><a href="https://github.com/caltechlibrary/newt">GitHub</a></li>
</ul>
</nav>
<section>
<h1 id="newts-newt-config-explained">Newt’s <strong>newt config</strong>
Explained</h1>
<p>The <strong>config</strong> action can create a new skeleton Newt
YAML file. It can be used to update an applications configuration and
applications metadata. It allows you to select which applications are
known by your data pipeline as well as set basic runtime configuration
which is used by the <code>newt run</code> command. In addition you can
use Newt Config to update the configurations in the applications’
property. You might need to do this if the standard ports for the
network services need to be changed.</p>
<h2 id="create-your-first-newt-yaml-file">Create your first Newt YAML
file</h2>
<p>By default if you do not provide a YAML filename the
<code>newt config</code> command will use the filename of “app.yaml”.
Let’s try creating a “app.yaml” by running the config action.</p>
<pre class="shell"><code>newt config app.yaml</code></pre>
<p>You will now get prompted by a series of questions that will
configure what is listed inside the applications’ property.</p>
<p>Here’ is an example of me running the command you can play
through.</p>
<p>FIXME: Insert Asciienema demo of run
<code>newt config app.yaml</code> here.</p>
<p>FIXME: Explain the menu system and inactive flow of question.</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/usr/bin/env newt check</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="co">#</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="co"># This was generated by rsdoiel on 2024-08-08 with newt version 0.0.8 ea131b9.</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="co">#</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="fu">app_metadata</span><span class="kw">:</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">name</span><span class="kw">:</span><span class="at"> app</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">title</span><span class="kw">:</span><span class="at"> This is a tutorial app using Newt</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">copyright</span><span class="kw">:</span><span class="at"> </span><span class="dv">2024</span></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">logo_link</span><span class="kw">:</span><span class="at"> /media/logo.svg</span></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">logo_text</span><span class="kw">:</span><span class="at"> Logo of the demo app</span></span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">header_text</span><span class="kw">:</span><span class="at"> A Newt Turtorial YAML file</span></span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">header_link</span><span class="kw">:</span><span class="at"> https://caltechlibrary.github.io/newt</span></span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">contact_address</span><span class="kw">:</span><span class="at"> 123 Calle Quattro, Colonia Major, Estat de Providencia, Republic of the Collective Imagination, 456789</span></span>
<span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a><span class="fu">applications</span><span class="kw">:</span></span>
<span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">router</span><span class="kw">:</span></span>
<span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">8010</span></span>
<span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">template_engine</span><span class="kw">:</span></span>
<span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">8011</span></span>
<span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">base_dir</span><span class="kw">:</span><span class="at"> views</span></span>
<span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">partials_dir</span><span class="kw">:</span><span class="at"> partials</span></span>
<span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">ext_name</span><span class="kw">:</span><span class="at"> .hbs</span></span>
<span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">postgres</span><span class="kw">:</span></span>
<span id="cb2-23"><a href="#cb2-23" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">namespace</span><span class="kw">:</span><span class="at"> app</span></span>
<span id="cb2-24"><a href="#cb2-24" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">5432</span></span>
<span id="cb2-25"><a href="#cb2-25" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">dsn</span><span class="kw">:</span><span class="at"> postgres://{PGUSER}:{PGPASSWORD}@localhost:5432/app.yaml</span></span>
<span id="cb2-26"><a href="#cb2-26" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">postgrest</span><span class="kw">:</span></span>
<span id="cb2-27"><a href="#cb2-27" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">app_path</span><span class="kw">:</span><span class="at"> postgrest</span></span>
<span id="cb2-28"><a href="#cb2-28" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">conf_path</span><span class="kw">:</span><span class="at"> postgrest.conf</span></span>
<span id="cb2-29"><a href="#cb2-29" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">port</span><span class="kw">:</span><span class="at"> </span><span class="dv">3000</span></span>
<span id="cb2-30"><a href="#cb2-30" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="fu">enviroment</span><span class="kw">:</span></span>
<span id="cb2-31"><a href="#cb2-31" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> PGUSER</span></span>
<span id="cb2-32"><a href="#cb2-32" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> PGPASSWORD</span></span></code></pre></div>
<p>When I accepted using Postgres the config action knows that the
connection string can be built from the standard environment variables
expected by Postgres’ psql and database connectors. That is why even
through I answered “N” to the question about setting up environment
variables to import I still have environment variables listed.</p>
<p>NOTE: The config option can be used to update an existing Newt YAML
file, e.g. “app.yaml”. If you change the configuration then you’ll be
prompted to save the changes as the last question. If you save the
changes the prior file will be saved to a “.bak” version before writing
the changes to disk. If you want to abort your changes completely then
you can press “control C” to quit at any time before the final save
prompt.</p>
<p>Next up <a href="model_explained.html">Newt Model</a></p>
</section>
<footer>
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
<span>© 2024 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
<span><a href="mailto:library@caltech.edu">Email Us</a></span>
<a class="cl-hide" href="sitemap.xml">Site Map</a>
</footer>
</body>
</html>