Last active
January 18, 2019 01:28
-
-
Save gkumarau/2d85fb59cbd3892c1f9689051cd37123 to your computer and use it in GitHub Desktop.
A simple example to demonstrate use of local variables in Jsonnet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local host = '10.0.0.120'; // Standard local variable ends with semicolon(;). | |
local http_port = 8080; | |
{ | |
local db_port = 3128, // A local variable next to JSON fields ends with comma(,). | |
app_protocol:: 'http', // A special hidden variable next to fields use (::) instead of (=) or (:). | |
environment_config: { | |
app: { | |
name: 'Sample app', | |
url: $.app_protocol + '://' + host + ':' + http_port + 'app/' | |
}, | |
database: { | |
name: "mysql database", | |
username: "user", | |
password: "password", | |
host: host, | |
port: db_port, | |
}, | |
rest_api: $.app_protocol + '://' + host + ':' + http_port + '/v2/api/' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment