Module: Conify::Manifest
Instance Method Summary
collapse
Methods included from Helpers
allow_user_response, ask_for_conflux_creds, ask_for_password, ask_for_password_on_windows, camelize, display, echo_off, echo_on, error, exclusive_deep_merge, format_with_bang, host, host_url, kensa_manifest_name, kensa_manifest_path, manifest_content, manifest_filename, manifest_path, manually_added_methods, open_url, running_on_a_mac?, running_on_windows?, site_url, to_table, with_tty
Instance Method Details
#conflux_template ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/conify/manifest.rb', line 34
def conflux_template
<<-JSON
{
"id": "myservice",
"api": {
"config_vars": [
"MYSERVICE_URL"
],
"password": "",
"sso_salt": "",
"production": {
"base_url": "https://yourapp.com/conflux/resources",
"sso_url": "https://yourapp.com/conflux/sso"
},
"test": {
"base_url": "http://localhost:#{default_port}/conflux/resources",
"sso_url": "http://localhost:#{default_port}/conflux/sso"
}
}
}
JSON
end
|
#default_port ⇒ Object
13
14
15
|
# File 'lib/conify/manifest.rb', line 13
def default_port
3000
end
|
#password_gen(size = 8) ⇒ Object
9
10
11
|
# File 'lib/conify/manifest.rb', line 9
def password_gen(size = 8)
SecureRandom.hex(size)
end
|
#template ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/conify/manifest.rb', line 17
def template
manifest = JSON.parse(conflux_template)
if File.exists?(kensa_manifest_name)
kensa_manifest = JSON.parse(File.read(kensa_manifest_path)) rescue {}
manifest = exclusive_deep_merge(manifest, kensa_manifest)
end
manifest['api']['password'] = password_gen
manifest['api']['sso_salt'] = password_gen
JSON.pretty_generate(manifest)
end
|