# Condividere impostazioni con ENV e la sintassi [key]

> Registra valori con ENV() e usali negli URL e nella configurazione dei componenti con il segnaposto [key].

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: it
Content-SHA256: d2fd585804a48087b27f1e96eb3790c9141bba3d53ff653aa053a1fd6ebfb060
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: jcomponent20@3fedd009a277f50fddc608b97afbec553b67c51b
Review: not-recorded

`ENV(name, value)` registra un valore per l'intera pagina e `ENV(name)` lo legge. Ovunque jComponent accetti un testo che può contenere `[name]` (ad esempio l'URL di `AJAX()` e `IMPORT()`), il segnaposto viene sostituito con il valore, così imposti l'indirizzo della tua API in un unico punto. `'[name]'.env()` fa la stessa sostituzione su qualsiasi stringa.

```html public/index.html
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>jComponent</title>
	<link rel="stylesheet" href="//cdn.componentator.com/spa.min@20.css" />
	<script src="//cdn.componentator.com/spa.min@20.js"></script>
</head>
<body>
	<p class="out"></p>

	<script>

		ENV('api', '/api/v1');
		ENV('version', '20');

		$('.out').text('[api]/users?v=[version]'.env());

	</script>

</body>
</html>
```
