[tor-commits] [flashproxy/master] install the appengine files as data files in $(pkgdatadir)

infinity0 at torproject.org infinity0 at torproject.org
Thu Nov 21 13:18:46 UTC 2013


commit aafd15b8927e0d7519152d3e88f655b571037f04
Author: Ximin Luo <infinity0 at gmx.com>
Date:   Fri Sep 13 14:05:52 2013 +0100

    install the appengine files as data files in $(pkgdatadir)
---
 facilitator/Makefile.am         |    2 ++
 facilitator/appengine/README    |    4 ++--
 facilitator/appengine/app.yaml  |    3 ++-
 facilitator/appengine/config.go |    5 +++++
 facilitator/appengine/fp-reg.go |    7 ++++---
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am
index b0df18f..200053a 100644
--- a/facilitator/Makefile.am
+++ b/facilitator/Makefile.am
@@ -3,6 +3,7 @@
 fpfacilitatoruser = @fpfacilitatoruser@
 initscriptdir = $(sysconfdir)/init.d
 exampledir = $(docdir)/examples
+appenginedir = $(pkgdatadir)/appengine
 
 # automake PLVs
 
@@ -11,6 +12,7 @@ initscript_SCRIPTS = init.d/facilitator init.d/facilitator-email-poller init.d/f
 
 dist_doc_DATA = doc/appengine-howto.txt doc/facilitator-howto.txt doc/gmail-howto.txt README
 dist_example_DATA = conf/fp-facilitator
+dist_appengine_DATA = appengine/app.yaml appengine/config.go appengine/fp-reg.go appengine/README
 
 dist_TESTS = facilitator-test
 
diff --git a/facilitator/appengine/README b/facilitator/appengine/README
index 00d0611..2e1e33d 100644
--- a/facilitator/appengine/README
+++ b/facilitator/appengine/README
@@ -4,8 +4,8 @@ This is the server-side code that runs on Google App Engine for the
 See doc/appengine-howto.txt for information about setting up an
 application.
 
-To run with the development server:
+To run locally using the development server:
 $ ~/google_appengine/dev_appserver.py appengine/
 
 To upload a new version:
-$ torify ~/google_appengine/appcfg.py update appengine/
+$ torify ~/google_appengine/appcfg.py -A $YOUR_APP_ID update appengine/
diff --git a/facilitator/appengine/app.yaml b/facilitator/appengine/app.yaml
index 3b99ada..7269664 100644
--- a/facilitator/appengine/app.yaml
+++ b/facilitator/appengine/app.yaml
@@ -1,4 +1,5 @@
-application: fp-reg-a
+# override this with appcfg.py -A $YOUR_APP_ID
+application: facilitator-registration-example
 version: 1
 runtime: go
 api_version: go1
diff --git a/facilitator/appengine/config.go b/facilitator/appengine/config.go
new file mode 100644
index 0000000..17098b5
--- /dev/null
+++ b/facilitator/appengine/config.go
@@ -0,0 +1,5 @@
+package fp_reg
+
+// host[:port] of the facilitator you want to register with
+// for example, fp-facilitator.org
+const FP_FACILITATOR = ""
diff --git a/facilitator/appengine/fp-reg.go b/facilitator/appengine/fp-reg.go
index d4f84c2..44e9528 100644
--- a/facilitator/appengine/fp-reg.go
+++ b/facilitator/appengine/fp-reg.go
@@ -10,8 +10,6 @@ import (
 	"appengine/urlfetch"
 )
 
-const BASE = "https://fp-facilitator.org/reg/"
-
 func robotsTxtHandler(w http.ResponseWriter, r *http.Request) {
 	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
 	w.Write([]byte("User-agent: *\nDisallow:\n"))
@@ -33,7 +31,7 @@ func regHandler(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 	client := urlfetch.Client(appengine.NewContext(r))
-	resp, err := client.Get(BASE + blob)
+	resp, err := client.Get("https://" + FP_FACILITATOR + "/reg/" + blob)
 	if err != nil {
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return
@@ -51,4 +49,7 @@ func init() {
 	http.HandleFunc("/robots.txt", robotsTxtHandler)
 	http.HandleFunc("/ip", ipHandler)
 	http.HandleFunc("/reg/", regHandler)
+	if FP_FACILITATOR == "" {
+		panic("FP_FACILITATOR empty; did you forget to edit config.go?")
+	}
 }





More information about the tor-commits mailing list