Pārlūkot izejas kodu

🐛: fix WEBHOOK_KEY

ulyc 2 gadi atpakaļ
vecāks
revīzija
af5369c64d
3 mainītis faili ar 34 papildinājumiem un 8 dzēšanām
  1. 5 4
      init.sh
  2. 2 2
      template/Dockerfile.template
  3. 27 2
      template/config.ini.template

+ 5 - 4
init.sh

@@ -41,16 +41,16 @@ function progress() {
   printf "[▓"
   while kill -0 "$1" 2>/dev/null; do
     printf "▓"
-    sleep 1
+    sleep 0.05
   done
   wait "$1"
   printf "▓] done!"
 }
 
 function generate_config() {
-  service_key=$(grep <genkeys Service | awk -F: '{print $2}')
-  network_key=$(grep <genkeys Network | awk -F: '{print $2}')
-  webhook_key=$(grep <genkeys Webhook | awk -F: 'BEGIN{print $2}')
+  service_key=$(grep <genkeys "Service" | awk -F: '{sub(/[[:blank:]]*/,"");print $2}')
+  network_key=$(grep <genkeys "Network" | awk -F: '{sub(/[[:blank:]]*/,"");print $2}')
+  webhook_key=$(grep <genkeys "Webhook Private" | awk -F: '{sub(/[[:blank:]]*/,"");print $2}')
   sed "s/{{SERVICE_KEY}}/$service_key/" ./template/config.ini.template >config.ini
   sed -i "s/{{NETWORK_KEY}}/$network_key/" config.ini
   sed -i "s/{{WEBHOOK_KEY}}/$webhook_key/" config.ini
@@ -203,3 +203,4 @@ echo
 echo
 
 # TODO modules config
+# TODO Database secret

+ 2 - 2
template/Dockerfile.template

@@ -1,8 +1,8 @@
 FROM sr.ht-base:dev
 COPY ./start.sh /
-
+RUN chmod +x /start.sh
 RUN apk add  {{MODULES}}
-CMD ["./start.sh"]
+CMD ["/bin/sh", "start.sh"]
 
 
 

+ 27 - 2
template/config.ini.template

@@ -88,7 +88,7 @@ pgp-key-id=
 # Use the `srht-keygen webhook` command to generate this key. Put the private
 # key here and distribute the public key to anyone who would want to verify
 # webhook payloads from your service.
-private-key= {{WEBHOOK_KEY}}
+private-key={{WEBHOOK_KEY}}
 
 
 [git.sr.ht]
@@ -212,4 +212,29 @@ enabled=no
 #
 # Get your keys at https://dashboard.stripe.com/account/apikeys
 stripe-public-key=
-stripe-secret-key=
+stripe-secret-key=
+
+[paste.sr.ht]
+#
+# URL paste.sr.ht is being served at (protocol://domain)
+origin=http://paste.sr.ht.local
+#
+# Address and port to bind the debug server to
+debug-host=0.0.0.0
+debug-port=5011
+#
+# Configures the SQLAlchemy connection string for the database.
+connection-string=postgresql://postgres@localhost/paste.sr.ht
+#
+# Set to "yes" to automatically run migrations on package upgrade.
+migrate-on-upgrade=yes
+#
+# paste.sr.ht's OAuth client ID and secret for meta.sr.ht
+# Register your client at meta.example.org/oauth
+oauth-client-id=
+oauth-client-secret=
+#
+# Origin URL for the API
+# Only needed if not run behind a reverse proxy, e.g. for local development.
+# By default, the API port is 100 more than the web port
+#api-origin=http://localhost:5111