diff options
Diffstat (limited to 'manifests/mirror_db.pp')
-rw-r--r-- | manifests/mirror_db.pp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/manifests/mirror_db.pp b/manifests/mirror_db.pp index c2e5b21..06007e0 100644 --- a/manifests/mirror_db.pp +++ b/manifests/mirror_db.pp @@ -3,14 +3,18 @@ define couchdb::mirror_db ( $from='', $to='' ) { - $source = "$from$name" - $target = "$to$name" + $source = "$from/$name" + if $to == '' { $target = $name } + else { $target = "$to/$name" } + + $replication_user = "replication" + $replication_role = "replication" couchdb::document { "${name}_replication": - db => "_replicate", + db => "_replicator", id => "${name}_replication", host => $host, - data => "{ \"source\": ${source}, \"target\": ${target}, \"continuous\": true }", + data => "{ \"source\": \"${source}\", \"target\": \"${target}\", \"continuous\": true, \"user_ctx\": { \"name\": \"${replication_user}\", \"roles\": [\"${replication_role}\"] } }", require => Couchdb::Query["create_db_${name}"] } } |