aboutsummaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-05-29 02:13:00 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-05-29 13:59:57 +0100
commit591aa261d17e60619708b48b312b5db6ed64df10 (patch)
tree58dc4970f16ef7c33574ba915ee1c069e57977f8 /testdata
parent5cbf84c566f648dd7e54a2fdea1b645ef96627b1 (diff)
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.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/config.go54
1 files changed, 30 insertions, 24 deletions
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 {}
+`)