Sha256: 27bb093a8db42a32506d8356904796996c363cb5d8c1a1a821d10c5b67c8425d

Contents?: true

Size: 1.21 KB

Versions: 30

Compression:

Stored size: 1.21 KB

Contents

Jsonnet is a domain specific configuration language that helps you define JSON data.
http://jsonnet.org/

In hako, you can use Jsonnet format for defining applications.

# External variables
Jsonnet provide a way to refer external variables by `std.extVar(x)`.
http://jsonnet.org/docs/stdlib.html#ext_vars

## appId
`std.extVar('appId')` returns application id of the definition.

### Example
```
% cat awesome-app.jsonnet
{
  id: std.extVar('appId'),
}
% hako show-definition awesome-app.jsonnet
---
id: awesome-app
```

# Native functions
Jsonnet provide a way to refer native functions by `std.native(x)`.

## provide.$NAME
`std.native('provide.$NAME')` returns a function which returns a corresponding EnvProvider.

### Example
```
% cat awesome-app.env
username=eagletmt
% cat awesome-app.yml
password: hako
% cat awesome-app.jsonnet
local provideFromFile(name) = std.native('provide.file')(std.toString({ path: 'awesome-app.env' }), name);
local provideFromYaml(name) = std.native('provide.yaml')(std.toString({ path: 'awesome-app.yml' }), name);

{
  username: provideFromFile('username'),
  password: provideFromYaml('password'),
}
% hako show-definition --expand awesome-app.jsonnet
---
password: hako
username: eagletmt
```

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
hako-2.4.0 docs/jsonnet.md
hako-2.3.1 docs/jsonnet.md
hako-2.3.0 docs/jsonnet.md
hako-2.2.0 docs/jsonnet.md
hako-2.1.0 docs/jsonnet.md
hako-2.0.4 docs/jsonnet.md
hako-2.0.3 docs/jsonnet.md
hako-2.0.2 docs/jsonnet.md
hako-2.0.1 docs/jsonnet.md
hako-2.0.0 docs/jsonnet.md