Index

resty-gitweb / c69d6c0

A git web interface for Lua/OpenResty (you're on it right now!)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
703 Jan 2021 10:11609d330libgit2 binding updates, README updatesJosh Stockin111G

Blob @ resty-gitweb / init.lua

text/plain1590 bytesdownload raw
1-- resty-gitweb@init.lua
2-- Preloads scripts and config for OpenResty workers
3
4-- Copyright (c) 2020 Joshua 'joshuas3' Stockin
5-- <https://git.joshstock.in/resty-gitweb>
6-- This software is licensed under the MIT License.
7
8local git = require "git/git"
9
10local pages_blob = require "pages/blob"
11local pages_commit = require "pages/commit"
12local pages_download = require "pages/download"
13local pages_index = require "pages/index"
14local pages_log = require "pages/log"
15local pages_row = require "pages/raw"
16local pages_refs = require "pages/refs"
17local pages_tree = require "pages/tree"
18
19local builder = require "utils/builder"
20local nav = require "utils/nav"
21local parse_uri = require "utils/parse_uri"
22local tabulate = require "utils/tabulate"
23local utils = require "utils/utils"
24
25-- Load YAML configuration
26local _lyaml = require "lyaml"
27
28-- TODO: Read config file location from nginx env settings
29local _yaml_config_file = io.open("/home/josh/repos/joshstock.in/resty-gitweb.yaml")
30yaml_config = _lyaml.load(_yaml_config_file:read("*a"))
31_yaml_config_file:close()
32
33local ffi = require("ffi")
34
35ffi.include = function(header)
36 local p = io.popen("echo '#include <"..header..">' | gcc -E -")
37 local c = {}
38 while true do
39 local line = p:read()
40 if line then
41 if not line:match("^#") then
42 table.insert(c, line)
43 end
44 else
45 break
46 end
47 end
48 p:close()
49 ffi.cdef(table.concat(c, "\n"))
50end
51
52ffi.include("git2.h")
53git2 = ffi.load("git2")
54git2.git_libgit2_init()
55