summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-29 21:29:46 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-29 21:35:57 +0100
commitea76a5d8ea33b5be2e36f756c34244010816badf (patch)
treead06bf22402492d6cf62917a1b9cccf8e326cea8
parentMinor fixes (diff)
downloadcgit-ea76a5d8ea33b5be2e36f756c34244010816badf.tar.gz
cgit-ea76a5d8ea33b5be2e36f756c34244010816badf.tar.xz
Move cgit conf to hiera.
-rw-r--r--manifests/init.pp12
-rw-r--r--templates/hugo-authentication.lua.epp (renamed from files/filters/hugo-authentication.lua)14
2 files changed, 17 insertions, 9 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index c1a981b..71ed6db 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -8,6 +8,10 @@ class cgit (
String $source_filter,
String $scan_path,
Array[String] $clone_url,
+ Array[String] $public_repos = [],
+ Array[Struct[{
+ name => String,
+ pass => String }]] $users = [],
) {
# TODO figure out where CSS comes from
@@ -48,7 +52,7 @@ class cgit (
ensure => directory,
}
- [$about_filter, $source_filter, $auth_filter].each |$f| {
+ [$about_filter, $source_filter].each |$f| {
file { "${filterpath}/${f}":
ensure => file,
source => "puppet:///modules/cgit/filters/${f}",
@@ -59,4 +63,10 @@ class cgit (
}
}
+ file { "${filterpath}/${auth_filter}":
+ ensure => file,
+ content => epp("cgit/${auth_filter}.epp"),
+ mode => '0444',
+ }
+
}
diff --git a/files/filters/hugo-authentication.lua b/templates/hugo-authentication.lua.epp
index df97579..0c73644 100644
--- a/files/filters/hugo-authentication.lua
+++ b/templates/hugo-authentication.lua.epp
@@ -24,17 +24,15 @@ local protected_repos = {
}
local public_repos = {}
-public_repos["wiki-public" ] = true
-public_repos["lyslib" ] = true
-public_repos["calp" ] = true
-public_repos["texttv" ] = true
-public_repos["scheme-monad" ] = true
-public_repos["scheme/math-parse" ] = true
-public_repos["file-descriptor-graph"] = true
+<%- $cgit::public_repos.each |$repo| { -%>
+public_repos["<%= $repo %>"] = true
+<%- } -%>
-- A list of users and hashes, generated with `mkpasswd -m sha-512 -R 300000`.
local users = {
- hugo = "$6$13z1Pf.U8itrCRX6$g2BZpaMk1CLiT6117paWXB2qdQFRc3rsGWL4iF5h5QbHo27oljTdHk69oQWAvqlVf13aLTUF3nYw65lEp88r/1"
+ <%- $cgit::users.each |$user| { -%>
+ <%= $user['name'] %> = "<%= $user['pass'] %>"
+ <%- } -%>
}
-- Set this to a path this script can write to for storing a persistent