From 5de3951ccf91019d83800698dca2ef8a70761b5e Mon Sep 17 00:00:00 2001
From: Aaron Boodman
Date: Sat, 28 Dec 2013 01:43:19 -0800
Subject: [PATCH] Enable Flickr importer in the production server. This was
meant to work previously but there was a bug.
Change-Id: I657a20bd97a9e186d6b2bb4ec34553889e7c262c
---
pkg/serverconfig/genconfig.go | 5 +-
pkg/serverconfig/testdata/flickr-want.json | 112 +++++++++++++++++++++
pkg/serverconfig/testdata/flickr.json | 11 ++
website/content/docs/server-config | 2 +-
4 files changed, 128 insertions(+), 2 deletions(-)
create mode 100644 pkg/serverconfig/testdata/flickr-want.json
create mode 100644 pkg/serverconfig/testdata/flickr.json
diff --git a/pkg/serverconfig/genconfig.go b/pkg/serverconfig/genconfig.go
index 231e7ae5a..66dca8d62 100644
--- a/pkg/serverconfig/genconfig.go
+++ b/pkg/serverconfig/genconfig.go
@@ -459,7 +459,10 @@ func genLowLevelPrefixes(params *configPrefixesParams, ownerName string) (m json
if params.flickr != "" {
m["/importer-flickr/"] = map[string]interface{}{
- "apiKey": params.flickr,
+ "handler": "importer-flickr",
+ "handlerArgs": map[string]interface{}{
+ "apiKey": params.flickr,
+ },
}
}
diff --git a/pkg/serverconfig/testdata/flickr-want.json b/pkg/serverconfig/testdata/flickr-want.json
new file mode 100644
index 000000000..3f9a94335
--- /dev/null
+++ b/pkg/serverconfig/testdata/flickr-want.json
@@ -0,0 +1,112 @@
+{
+ "auth": "userpass:camlistore:pass3179",
+ "https": false,
+ "listen": "localhost:3179",
+ "prefixes": {
+ "/": {
+ "handler": "root",
+ "handlerArgs": {
+ "blobRoot": "/bs-and-maybe-also-index/",
+ "ownerName": "Alice",
+ "searchRoot": "/my-search/",
+ "statusRoot": "/status/",
+ "stealth": false
+ }
+ },
+ "/bs-and-index/": {
+ "handler": "storage-replica",
+ "handlerArgs": {
+ "backends": [
+ "/bs/",
+ "/index-kv/"
+ ]
+ }
+ },
+ "/bs-and-maybe-also-index/": {
+ "handler": "storage-cond",
+ "handlerArgs": {
+ "read": "/bs/",
+ "write": {
+ "else": "/bs/",
+ "if": "isSchema",
+ "then": "/bs-and-index/"
+ }
+ }
+ },
+ "/bs/": {
+ "handler": "storage-filesystem",
+ "handlerArgs": {
+ "path": "/tmp/blobs"
+ }
+ },
+ "/cache/": {
+ "handler": "storage-filesystem",
+ "handlerArgs": {
+ "path": "/tmp/blobs/cache"
+ }
+ },
+ "/importer-flickr/": {
+ "handler": "importer-flickr",
+ "handlerArgs": {
+ "apiKey": "monkey:balls"
+ }
+ },
+ "/index-kv/": {
+ "handler": "storage-kvfileindexer",
+ "handlerArgs": {
+ "blobSource": "/bs/",
+ "file": "/path/to/indexkv.db"
+ }
+ },
+ "/my-search/": {
+ "handler": "search",
+ "handlerArgs": {
+ "index": "/index-kv/",
+ "owner": "sha1-f2b0b7da718b97ce8c31591d8ed4645c777f3ef4",
+ "slurpToMemory": true
+ }
+ },
+ "/setup/": {
+ "handler": "setup"
+ },
+ "/share/": {
+ "handler": "share",
+ "handlerArgs": {
+ "blobRoot": "/bs/"
+ }
+ },
+ "/sighelper/": {
+ "handler": "jsonsign",
+ "handlerArgs": {
+ "keyId": "26F5ABDA",
+ "publicKeyDest": "/bs-and-index/",
+ "secretRing": "/path/to/secring"
+ }
+ },
+ "/status/": {
+ "handler": "status"
+ },
+ "/sync/": {
+ "handler": "sync",
+ "handlerArgs": {
+ "from": "/bs/",
+ "queue": {
+ "file": "/tmp/blobs/sync-to-index-queue.kv",
+ "type": "kv"
+ },
+ "to": "/index-kv/"
+ }
+ },
+ "/ui/": {
+ "handler": "ui",
+ "handlerArgs": {
+ "cache": "/cache/",
+ "jsonSignRoot": "/sighelper/",
+ "scaledImage": {
+ "file": "/tmp/blobs/thumbmeta.kv",
+ "type": "kv"
+ }
+ }
+ }
+ }
+}
diff --git a/pkg/serverconfig/testdata/flickr.json b/pkg/serverconfig/testdata/flickr.json
new file mode 100644
index 000000000..6be246318
--- /dev/null
+++ b/pkg/serverconfig/testdata/flickr.json
@@ -0,0 +1,11 @@
+{
+ "listen": "localhost:3179",
+ "auth": "userpass:camlistore:pass3179",
+ "blobPath": "/tmp/blobs",
+ "flickr": "monkey:balls",
+ "kvIndexFile": "/path/to/indexkv.db",
+ "identity": "26F5ABDA",
+ "identitySecretRing": "/path/to/secring",
+ "ownerName": "Alice",
+ "shareHandlerPath": "/share/"
+}
diff --git a/website/content/docs/server-config b/website/content/docs/server-config
index f05f5a460..ced89271f 100644
--- a/website/content/docs/server-config
+++ b/website/content/docs/server-config
@@ -23,7 +23,7 @@ web browser and restart the server.
baseURL
: Optional. If non-empty, this is the root of your URL prefix for your Camlistore server. Useful for when running behind a reverse proxy. Should not end in a slash. e.g. https://yourserver.example.com
-flickr
: Optional, and doesn't do anything yet. Support for continuous import from Flickr. Should be an API key and secret formatted as key
:secret
. Get yours by filling out this form.
+flickr
: Optional. Flickr importer. Should be a Flickr API key and secret formatted as key
:secret
. Get these values by filling out this form. There's no UI yet, but you can run it by navigating to /importer-flickr/?mode=start
. Progress is printed to the server's stdout.
https
: if "true", HTTPS is used