Application

By creating a application manifest, you can create your API endpoint for the services you use. This API endpoint will provide all the Queries and Mutations of each service, including what you defined.

In the spec property, the following child properties can be defined:

Properties

  • Name: The gateway name. Name of the gateway that will be used as the application's subdomain, e.g. myApp will create API endpoints at https://myapp.erp.dev/query. Cannot duplicate a NAME that is being used by other users. (required)
  • Cors: The origins. Defines the origin to which requests are allowed.
  • AllowedIPAddresses: A list of IP addresses authorized to access the application, preventing unauthorized access. Each entry is a string in the format CIDR. Example: ["1.1.1.1/32", "2.2.2.0/24"].
  • Auth: The authentication service. Defines the authentication service to be used.
  • Subgraphs: The services you use. For each service to be used, it is necessary to place a cue file, which is the core resource, within the services folder.

To deploy an application, you'll need to enable at least one service.

Example

<span><span style="color: var(--shiki-token-keyword)">package</span><span style="color: var(--shiki-color-text)"> application</span></span>
<span></span>
<span><span style="color: var(--shiki-token-keyword)">import</span><span style="color: var(--shiki-color-text)"> (</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">github.com/tailor-platform/tailorctl/schema/v2/application</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">github.com/tailor-platform/tailorctl/schema/v2/common</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">tailor.build/template/services/auth</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">tailor.build/template/services/tailordb</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">tailor.build/template/services/pipeline</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">tailor.build/template/environment</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">)</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">application.#Spec </span><span style="color: var(--shiki-token-keyword)">&amp;</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">	Name: </span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">my-app</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	Cors: [</span></span>
<span><span style="color: var(--shiki-color-text)">		</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">http://localhost:8080</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">		</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">http://localhost:8081</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">		</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">http://localhost:3000</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">	]</span></span>
<span><span style="color: var(--shiki-color-text)">	AllowedIPAddresses: [</span></span>
<span><span style="color: var(--shiki-color-text)">		</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">1.1.1.1/32</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">	]</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">// Auth service</span></span>
<span><span style="color: var(--shiki-color-text)">	Auth: application.#Auth </span><span style="color: var(--shiki-token-keyword)">&amp;</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">		Namespace: auth.Namespace</span></span>
<span><span style="color: var(--shiki-color-text)">		IdProviderConfigName: auth.IdProviderConfigs[</span><span style="color: var(--shiki-token-constant)">0</span><span style="color: var(--shiki-color-text)">].Name</span></span>
<span><span style="color: var(--shiki-color-text)">	}</span></span>
<span><span style="color: var(--shiki-color-text)">	Subgraphs: [</span></span>
<span><span style="color: var(--shiki-color-text)">	</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">//	TailorDB service</span></span>
<span><span style="color: var(--shiki-color-text)">	{type: common.#TailorDB</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> name:  tailordb.namespace}</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">	</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">//	Pipeline service</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">// 	{type: common.#Pipeline, name:  pipeline.namespace},</span></span>
<span><span style="color: var(--shiki-color-text)">	</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">//	Stateflow service</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-token-comment)">// 	{type: common.#StateFlow, name: stateflow.namespace},</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">	]</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span></span>