Skip to content

Commit 5ea7aef

Browse files
authored
Merge pull request #1 from Optum/initial
Initial
2 parents ac893b1 + e327933 commit 5ea7aef

15 files changed

+992
-231
lines changed

.gitignore

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
yarn.lock
2-
package-lock.json
1+
### Maven template
2+
target/
3+
4+
### OSX template
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Thumbnails
10+
._*
11+
12+
# Files that might appear in the root of a volume
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
20+
# Directories potentially created on remote AFP share
21+
.AppleDB
22+
.AppleDesktop
23+
Network Trash Folder
24+
Temporary Items
25+
.apdisk
26+
27+
### Java template
28+
*.class
29+
30+
### JetBrains template
31+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
32+
*.iml
33+
34+
## Directory-based project format:
35+
.idea/
36+
37+
## File-based project format:
38+
*.ipr
39+
*.iws

.mvn/wrapper/maven-wrapper.properties

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip

.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
java temurin-11.0.22+7

README.md

+99-229
Original file line numberDiff line numberDiff line change
@@ -1,229 +1,99 @@
1-
<div id="top"></div>
2-
3-
<!-- NOTES -->
4-
<!--
5-
*** Individual sections below can be removed if not needed
6-
-->
7-
8-
<!-- PROJECT SHIELDS -->
9-
<!--
10-
*** We are using markdown "reference style" links for readability.
11-
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
12-
*** See the bottom of this document for the declaration of the reference variables
13-
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
14-
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
15-
-->
16-
[![Contributors][contributors-shield]][contributors-url]
17-
[![Forks][forks-shield]][forks-url]
18-
[![Stargazers][stars-shield]][stars-url]
19-
[![Issues][issues-shield]][issues-url]
20-
[![MIT License][license-shield]][license-url]
21-
[![LinkedIn][linkedin-shield]][linkedin-url]
22-
23-
24-
25-
<!-- PROJECT LOGO -->
26-
<br />
27-
<div align="center">
28-
<a href="https://github.com/github_username/repo_name">
29-
<img src="images/logo.png" alt="Logo" width="80" height="80">
30-
</a>
31-
32-
<h3 align="center">project_title</h3>
33-
34-
<p align="center">
35-
project_description
36-
<br />
37-
<a href="https://github.com/github_username/repo_name"><strong>Explore the docs »</strong></a>
38-
<br />
39-
<br />
40-
<a href="https://github.com/github_username/repo_name">View Demo</a>
41-
·
42-
<a href="https://github.com/github_username/repo_name/issues">Report Bug</a>
43-
·
44-
<a href="https://github.com/github_username/repo_name/issues">Request Feature</a>
45-
</p>
46-
</div>
47-
48-
49-
50-
<!-- TABLE OF CONTENTS -->
51-
<details>
52-
<summary>Table of Contents</summary>
53-
<ol>
54-
<li>
55-
<a href="#about-the-project">About The Project</a>
56-
<ul>
57-
<li><a href="#built-with">Built With</a></li>
58-
</ul>
59-
</li>
60-
<li>
61-
<a href="#getting-started">Getting Started</a>
62-
<ul>
63-
<li><a href="#prerequisites">Prerequisites</a></li>
64-
<li><a href="#installation">Installation</a></li>
65-
</ul>
66-
</li>
67-
<li><a href="#usage">Usage</a></li>
68-
<li><a href="#roadmap">Roadmap</a></li>
69-
<li><a href="#contributing">Contributing</a></li>
70-
<li><a href="#license">License</a></li>
71-
<li><a href="#contact">Contact</a></li>
72-
<li><a href="#acknowledgments">Acknowledgments</a></li>
73-
</ol>
74-
</details>
75-
76-
77-
78-
<!-- ABOUT THE PROJECT -->
79-
## About The Project
80-
81-
[![Product Name Screen Shot][product-screenshot]](https://example.com)
82-
83-
Here's a blank template to get started: To avoid retyping too much info. Do a search and replace with your text editor for the following: `github_username`, `repo_name`, `twitter_handle`, `linkedin_username`, `email`, `email_client`, `project_title`, `project_description`
84-
85-
<p align="right">(<a href="#top">back to top</a>)</p>
86-
87-
88-
89-
### Built With
90-
91-
* [Next.js](https://nextjs.org/)
92-
* [React.js](https://reactjs.org/)
93-
* [Vue.js](https://vuejs.org/)
94-
* [Angular](https://angular.io/)
95-
* [Svelte](https://svelte.dev/)
96-
* [Laravel](https://laravel.com)
97-
* [Bootstrap](https://getbootstrap.com)
98-
* [JQuery](https://jquery.com)
99-
100-
<p align="right">(<a href="#top">back to top</a>)</p>
101-
102-
103-
104-
<!-- GETTING STARTED -->
105-
## Getting Started
106-
107-
This is an example of how you may give instructions on setting up your project locally.
108-
To get a local copy up and running follow these simple example steps.
109-
110-
### Prerequisites
111-
112-
This is an example of how to list things you need to use the software and how to install them.
113-
* npm
114-
```sh
115-
npm install npm@latest -g
116-
```
117-
118-
### Installation
119-
120-
1. Get a free API Key at [https://example.com](https://example.com)
121-
2. Clone the repo
122-
```sh
123-
git clone https://github.com/github_username/repo_name.git
124-
```
125-
3. Install NPM packages
126-
```sh
127-
npm install
128-
```
129-
4. Enter your API in `config.js`
130-
```js
131-
const API_KEY = 'ENTER YOUR API';
132-
```
133-
134-
<p align="right">(<a href="#top">back to top</a>)</p>
135-
136-
137-
138-
<!-- USAGE EXAMPLES -->
139-
## Usage
140-
141-
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
142-
143-
_For more examples, please refer to the [Documentation](https://example.com)_
144-
145-
<p align="right">(<a href="#top">back to top</a>)</p>
146-
147-
148-
149-
<!-- ROADMAP -->
150-
## Roadmap
151-
152-
- [] Feature 1
153-
- [] Feature 2
154-
- [] Feature 3
155-
- [] Nested Feature
156-
157-
See the [open issues](https://github.com/github_username/repo_name/issues) for a full list of proposed features (and known issues).
158-
159-
<p align="right">(<a href="#top">back to top</a>)</p>
160-
161-
162-
163-
<!-- CONTRIBUTING -->
164-
## Contributing
165-
166-
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
167-
168-
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
169-
Don't forget to give the project a star! Thanks again!
170-
171-
1. Fork the Project
172-
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
173-
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
174-
4. Push to the Branch (`git push origin feature/AmazingFeature`)
175-
5. Open a Pull Request
176-
177-
<p align="right">(<a href="#top">back to top</a>)</p>
178-
179-
180-
181-
<!-- LICENSE -->
182-
## License
183-
184-
Distributed under the Apache 2.0 License. See `LICENSE.txt` for more information.
185-
186-
<p align="right">(<a href="#top">back to top</a>)</p>
187-
188-
189-
190-
<!-- MAINTAINERS -->
191-
## Maintainers
192-
193-
- Full Name 1
194-
- GitHub Enterprise: [github_username](https://github.com/username1)
195-
196-
- Full Name 2
197-
- GitHub Enterprise: [github_username](https://github.com/username2)
198-
199-
200-
<p align="right">(<a href="#top">back to top</a>)</p>
201-
202-
203-
204-
<!-- ACKNOWLEDGMENTS -->
205-
## Acknowledgments
206-
207-
* []()
208-
* []()
209-
* []()
210-
211-
<p align="right">(<a href="#top">back to top</a>)</p>
212-
213-
214-
215-
<!-- MARKDOWN LINKS & IMAGES -->
216-
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
217-
[contributors-shield]: https://img.shields.io/github/contributors/github_username/repo_name.svg?style=for-the-badge
218-
[contributors-url]: https://github.com/github_username/repo_name/graphs/contributors
219-
[forks-shield]: https://img.shields.io/github/forks/github_username/repo_name.svg?style=for-the-badge
220-
[forks-url]: https://github.com/github_username/repo_name/network/members
221-
[stars-shield]: https://img.shields.io/github/stars/github_username/repo_name.svg?style=for-the-badge
222-
[stars-url]: https://github.com/github_username/repo_name/stargazers
223-
[issues-shield]: https://img.shields.io/github/issues/github_username/repo_name.svg?style=for-the-badge
224-
[issues-url]: https://github.com/github_username/repo_name/issues
225-
[license-shield]: https://img.shields.io/github/license/github_username/repo_name.svg?style=for-the-badge
226-
[license-url]: https://github.com/github_username/repo_name/blob/master/LICENSE.txt
227-
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
228-
[linkedin-url]: https://linkedin.com/in/linkedin_username
229-
[product-screenshot]: images/screenshot.png
1+
# templ
2+
3+
## Easy Handling of Delimiters that Accompany Optional Data
4+
5+
This library provides a simple solution to a common use case in configuration variables:
6+
> _A delimiter is needed to accompany optional data, but must not be present when the optional data is missing._
7+
8+
Traditionally this scenario is solved in one of two ways:
9+
* Treat the delimiter as required, forcing a default value to always be defined and available.
10+
* Embed the optional delimiter in the actual value of the optional data, essentially _corrupting_ the value of the data (`PORT="80"` becomes `PORT=":80"` but clearly the value `:80` is not a valid port number.)
11+
12+
## templ - Is a Primitive Library
13+
Don't expect to use `templ` without writing a little code around it: it is primitive. This library Does One Thing: the substitution processing. You'll need to provide the bindings into your context and use case.
14+
15+
## templ - Solution
16+
The solution pattern provided by `templ` is to include the delimiter(s) inside the double-braces template substitution syntax `{{}}` (as a prefix and/or a suffix).
17+
18+
### Case 1: Undefined value - delimiter is omitted
19+
```
20+
API_HOST="api.example.com"
21+
API_ENDPOINT="{{API_HOST}}{{:API_PORT}}"
22+
```
23+
#### Result: `api.example.com`
24+
(With `API_PORT` undefined, the `:` is excluded from the result.)
25+
26+
### Case 2: Defined value - delimiter is included
27+
```
28+
API_HOST="api.example.com"
29+
API_PORT="8080"
30+
API_ENDPOINT="{{API_HOST}}{{:API_PORT}}"
31+
```
32+
#### Result: `api.example.com:8080`
33+
(With `API_PORT` defined, the `:` is included in the result.)
34+
35+
## Supported Delimiters
36+
There are eighteen supported delimiters:
37+
38+
1. ` <space> `
39+
2. ` , `
40+
3. ` . `
41+
4. ` ; `
42+
5. ` : `
43+
6. ` ? `
44+
7. ` & `
45+
8. ` @ `
46+
9. ` # `
47+
10. ` / `
48+
11. ` ( `
49+
12. ` ) `
50+
13. ` < `
51+
14. ` > `
52+
15. ` _ `
53+
16. ` - `
54+
17. ` \ `
55+
18. ` | `
56+
57+
### Delimiter Rules
58+
* Delimiters can be used as a prefix and/or suffix.
59+
* Any number of delimiters can be used in any combination.
60+
61+
## Nested Evaluation (Dynamic Variables)
62+
Variables can be dynamic.
63+
64+
### Example 1:
65+
```
66+
INSTANCE="3"
67+
HOST_1="devhost1.example.com"
68+
HOST_2="devhost2.example.com"
69+
HOST_3="qa.example.com"
70+
HOST_4="example.com"
71+
SERVICE_ENDPOINT="{{HOST_{{INSTANCE}}}}"
72+
```
73+
74+
This usefulness is compounded when multiple variables are resolved:
75+
76+
### Example 1:
77+
```
78+
INSTANCE="3"
79+
HOST_1="devhost.example.com"
80+
PORT_1="8080"
81+
HOST_2="devhost.example.com"
82+
PORT_2="8081"
83+
HOST_3="qa.example.com"
84+
HOST_4="example.com"
85+
SERVICE_ENDPOINT="{{HOST_{{INSTANCE}}}}{{:PORT_{{INSTANCE}}}}"
86+
```
87+
88+
## UPPERCASE
89+
The value returned by a template evaluation can be converted to uppercase using the `^` character before the variable name.
90+
91+
### Example:
92+
```
93+
ENV="dev"
94+
HOST_DEV="vm123.example.com"
95+
HOST_QA="qa.example.com"
96+
HOST_PROD="example.com"
97+
SERVICE_ENDPOINT="{{HOST_{{^ENV}}}}"
98+
```
99+
> This example shows both the `^` UPPERCASE syntax, and the nested-template resolution to resolve values dynamically.

images/logo.png

-2.26 KB
Binary file not shown.

images/screenshot.png

-6.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)