diff --git a/flow/install.sh b/flow/install.sh index 3d1aa2de19..3cef318c58 100755 --- a/flow/install.sh +++ b/flow/install.sh @@ -98,6 +98,7 @@ copy_files "sunstone/routes/*" "$SUNSTONE_LOCATION/routes" # Do not link the ETC files LINK="no" +copy_files "sunstone/etc/sunstone-appflow.conf" "$ETC_LOCATION" copy_files "config/appflow-server.conf" "$ETC_LOCATION" diff --git a/flow/sunstone/etc/sunstone-appflow.conf b/flow/sunstone/etc/sunstone-appflow.conf new file mode 100644 index 0000000000..188a091b56 --- /dev/null +++ b/flow/sunstone/etc/sunstone-appflow.conf @@ -0,0 +1,7 @@ +################################################################################ +# Appflow +################################################################################ + +# Appflow endpoint +# +:appflow_server: http://localhost:2474/ \ No newline at end of file diff --git a/flow/sunstone/routes/appflow.rb b/flow/sunstone/routes/appflow.rb index 87b5730278..f47ff4e725 100644 --- a/flow/sunstone/routes/appflow.rb +++ b/flow/sunstone/routes/appflow.rb @@ -1,14 +1,25 @@ +APPFLOW_CONF_FILE = ETC_LOCATION + "/sunstone-appflow.conf" + $: << RUBY_LIB_LOCATION+"/apptools/flow" require 'appflow_client' +begin + appflow_conf = YAML.load_file(APPFLOW_CONF_FILE) +rescue Exception => e + STDERR.puts "Error parsing config file #{APPFLOW_CONF_FILE}: #{e.message}" + exit 1 +end + +set :appflow_config, appflow_conf + helpers do def build_client flow_client = settings.cloud_auth.client(session[:user]) split_array = flow_client.one_auth.split(':') Service::Client.new( - :url => settings.config[:appflow_server], + :url => settings.appflow_config[:appflow_server], :user_agent => "Sunstone", :username => split_array.shift, :password => split_array.join(':'))