serve

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package serve는 위키를 읽기 전용 웹 뷰어로 노출한다.

노출 범위는 ADR 0044가 정한다. context 와 root_files 만 보이고 inbox 와 sources 는 목록에도 URL 에도 없다. archive 는 기본으로 감추고 플래그로 연다. sensitivity 속성이 켜진 위키에서는 private-local-only 와 restricted 를 뺀다. 그 제외를 뒤집는 플래그는 두지 않는다. ADR 0063이 더한 판정으로 indexable 이 거짓인 문서와 status 가 superseded 인 문서도 빠진다. sensitivity 가 internal 인 문서는 로컬 조회이므로 보여 준다.

쓰기 경로가 없다. POST 계열은 라우팅에 닿기 전에 막힌다. 판정과 검색은 internal 패키지를 그대로 부르므로 여기서 규칙을 다시 만들지 않는다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exposure

type Exposure = expose.Exposure

Exposure는 무엇이 노출되고 무엇이 제외되는지의 집계다. 판정과 함께 internal/expose 에 있으며 serve 는 그것을 시작 안내에 쓴다.

type Options

type Options struct {
	// IncludeArchive는 archive 문서를 노출할지 정한다. 기본은 거짓이다.
	IncludeArchive bool
	// ErrorLog는 요청 처리 중 난 오류를 적을 곳이다. 화면에는 사정을
	// 싣지 않으므로 서버를 띄운 사람이 볼 자리가 필요하다. nil 이면 버린다.
	ErrorLog io.Writer
}

Options는 노출 범위를 넓히는 선택지다. 넓히는 쪽만 있고 좁히는 쪽은 기본값이다. 기본이 전체 노출이면 사고가 나기 때문이다.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server는 위키 하나를 노출하는 웹 뷰어다. 상태를 갖지 않으며 요청마다 위키를 다시 읽는다. 서버가 뜬 뒤에 CLI 가 문서를 고쳐도 화면이 옛 내용을 보이지 않게 하기 위해서다.

func New

func New(root string, cfg config.Config, opts Options) *Server

New는 위키 경로와 설정으로 서버를 만든다. 설정은 호출자가 읽어서 준다. 위키가 아닌 디렉토리 판정은 커맨드 계층의 몫이다.

func (*Server) Exposure

func (s *Server) Exposure() (Exposure, error)

Exposure는 지금 위키를 순회해 노출과 제외를 집계한다. 서버를 띄우기 전에 무엇이 보이는지 알리는 데 쓴다.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler는 서버의 HTTP 핸들러를 만든다. 실제 포트를 여는 것은 호출자의 몫이라 이 함수만으로 시험할 수 있다.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL