From 591aa261d17e60619708b48b312b5db6ed64df10 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Sun, 29 May 2016 02:13:00 +0100 Subject: Switch from json to hcl configs This is backward-compatible with the JSON config format - this is a non-breaking change. HCL treats config blocks as repeated fields so the config has to be unmarshalled into a struct comprised of []Server, []Auth, []SSH first. --- testdata/config.go | 54 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'testdata') diff --git a/testdata/config.go b/testdata/config.go index bb2f511..9ad9394 100644 --- a/testdata/config.go +++ b/testdata/config.go @@ -1,32 +1,38 @@ package testdata -var ServerConfig = []byte(`{ - "server": { - "use_tls": true, - "tls_key": "server.key", - "tls_cert": "server.crt", - "port": 443, - "cookie_secret": "supersecret" +var ServerConfig = []byte(` + server { + use_tls = true + tls_key = "server.key" + tls_cert = "server.crt" + port = 443 + cookie_secret = "supersecret" } -}`) + auth {} + ssh {} +`) -var AuthConfig = []byte(`{ - "auth": { - "provider": "google", - "oauth_client_id": "client_id", - "oauth_client_secret": "secret", - "oauth_callback_url": "https://sshca.example.com/auth/callback", - "provider_opts": { - "domain": "example.com" +var AuthConfig = []byte(` + auth { + provider = "google" + oauth_client_id = "client_id" + oauth_client_secret = "secret" + oauth_callback_url = "https://sshca.example.com/auth/callback" + provider_opts { + domain = "example.com" } } -}`) + server {} + ssh {} +`) -var SSHConfig = []byte(`{ - "ssh": { - "signing_key": "signing_key", - "additional_principals": ["ec2-user", "ubuntu"], - "max_age": "720h", - "permissions": ["permit-pty", "permit-X11-forwarding", "permit-port-forwarding", "permit-user-rc"] +var SSHConfig = []byte(` + ssh { + signing_key = "signing_key" + additional_principals = ["ec2-user", "ubuntu"] + max_age = "720h" + permissions = ["permit-pty", "permit-X11-forwarding", "permit-port-forwarding", "permit-user-rc"] } -}`) + auth {} + server {} +`) -- cgit v1.2.3