]> Cypherpunks.ru repositories - gocheese.git/blob - usage.go
-auth-required option and optional :ro per-user attribute
[gocheese.git] / usage.go
1 // GoCheese -- Python private package repository and caching proxy
2 // Copyright (C) 2019-2024 Sergey Matveev <stargrave@stargrave.org>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, version 3 of the License.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 package main
17
18 import (
19         "fmt"
20         "os"
21 )
22
23 const (
24         DefaultBind             = "[::]:8080"
25         DefaultMaxClients       = 128
26         DefaultNoRefreshURLPath = "/norefresh/"
27         DefaultRefreshURLPath   = "/simple/"
28         DefaultJSONURLPath      = "/pypi/"
29         DefaultPyPIURL          = "https://pypi.org/simple/"
30         DefaultJSONURL          = "https://pypi.org/pypi/"
31
32         Warranty = `This program is free software: you can redistribute it and/or modify
33 it under the terms of the GNU General Public License as published by
34 the Free Software Foundation, version 3 of the License.
35
36 This program is distributed in the hope that it will be useful,
37 but WITHOUT ANY WARRANTY; without even the implied warranty of
38 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39 GNU General Public License for more details.
40
41 You should have received a copy of the GNU General Public License
42 along with this program.  If not, see <http://www.gnu.org/licenses/>.`
43 )
44
45 func usage() {
46         fmt.Fprintf(os.Stderr, `Usage: gocheese [OPTIONS ...] /path/to/packages
47
48 Network transport options:
49   -ucspi          -- Work as UCSPI-TCP service instead of listening
50   -bind HOST:PORT -- TCP address to bind to (default: %s)
51   -maxclients N   -- Maximal amount of simultaneous clients (default: %d)
52
53 TLS enabling options:
54   -tls-cert PEM -- Path to TLS X.509 certificate
55   -tls-key PEM  -- Path to TLS X.509 private key
56
57 HTTP endpoints:
58   -norefresh URLPATH -- Non-refreshing Simple API path (default: %s)
59   -refresh URLPATH   -- Auto-refreshing Simple API path (default: %s)
60   -json URLPATH      -- JSON API path (default: %s)
61
62 Upstream PyPI:
63   -pypi URL      -- Upstream Simple API (default: %s)
64   -pypi-json URL -- Enable and use specified JSON API (default: %s)
65                     Disabled if empty.
66   -pypi-cert-hash HEX(SHA256(SPKI)) -- Authenticate upstream by its
67                                        X.509 certificate's hash
68 Password management:
69   -passwd PATH      -- Path to readable FIFO for loading passwords
70   -passwd-list PATH -- Path to writeable FIFO for listing logins
71   -passwd-check     -- Verify passwords format from stdin, then exit
72   -auth-required    -- Require authorisation even for read-only endpoints
73
74 Other options:
75   -log-timestamped -- Prepend timestamp to log messages
76   -fsck            -- Run integrity check of all packages
77   -version         -- Print version information
78   -warranty        -- Print warranty information
79
80 GOCHEESE_NO_SYNC=1 environment variable disable filesystem fsyncs.
81 `,
82                 DefaultBind,
83                 DefaultMaxClients,
84                 DefaultNoRefreshURLPath,
85                 DefaultRefreshURLPath,
86                 DefaultJSONURLPath,
87                 DefaultPyPIURL,
88                 DefaultJSONURLPath,
89         )
90 }