aboutsummaryrefslogtreecommitdiff
path: root/handler.go (unfollow)
Commit message (Collapse)AuthorFiles
2023-10-18Add support for sub-indexes (#120)Abhinav Gupta1
<details> <summary>Background</summary> Sally renders two kinds of pages: - packages: These are for packages defined in sally.yaml and any route under the package path. - indexes: These list available packages. The latter--indexes was previously only supported at '/', the root page. This leads to a slight UX issue: if you have a package with a / in its name (e.g. net/metrics): - example.com/net/metrics gives you the package page - example.com/ lists net/metrics - However, example.com/net fails with a 404 </details> This adds support for index pages on all parents of package pages. Therefore, if example.com/net/metrics exists, example.com/net will list all packages defined under that path. Resolves #31
2023-05-09Remove branch from PackageConfig struct (#93)Sung Yoon Whang1
* Remove branch from PackageConfig struct With #92, branch is no longer necessary from PackageConfig struct since go-source tag was removed. This removes Branch field from PackageConfig. * update README
2023-05-07Removing redundant go-source tag (#92)Anurag Bandyopadhyay1
* update: removing redundant go-source tag * fix: removing /.idea and adding dir to gitignore * fix: removing /.idea and removing branch field from from templateData * fix: pkgHndler defaultBranch rem revert * fix: minor typo * fix: removing assertion of template responses * fix: tabs * Update handler_test.go * Update handler_test.go * Update handler_test.go --------- Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com>
2023-04-29refactor(indexHandler): Don't retain configuration (#86)Abhinav Gupta1
Similar to the previous patch, this patch removes knowledge of the configuration from the index handler. Instead, the index handler is now passed a list of packageInfo structs each containing just the information needed to render the index page. This also obviates the need to duplicate the logic to compute the package import path in the index.html template.
2023-04-28refactor(packageHandler): Don't retain configuration (#85)Abhinav Gupta1
This patch removes the need to retain the configuration in the packageHandler struct. Instead, it retains only the fields that are required for the handler to function. This also allows us to pre-compute the canonical import path rather than calculating it on the request path.
2023-04-28config: Rename Package to PackageConfig, add docs (#84)Abhinav Gupta1
Renames the Package struct to PackageConfig to make it clear that it is a configuration struct. This differentiation will help disconnect the configuration-level representation from the runtime representation of this information. This patch also adds documentation to the config package that was previously missing.
2023-01-23Drop httprouter dependency (#71)Abhinav Gupta1
This drops the third-party HTTP router dependency. This dependency wasn't strictly necessary since our routing needs are quite basic: - `/$name` and `/$name/*` for all registered packages - `/` for root This is easily accomplished with `http.ServeMux`: - register `/$name` and `/$name/`. The latter will receive all subpackage requests. - register `/` and reject anything that isn't for exactly `/`.
2022-01-03Support package-level overrides for URLs (#52)Tyler Sullivan1
Sally accepts the base vanity URL (e.g. `go.uber.org`) in a top-level `url` key. This applies to all packages listed in the configuration. Add support for overriding the `url` on a per-package basis. This will provide for an easier transition period when migrating Go packages of an organization between hosts, for example from BitBucket to GitHub. With this, source code can be modified across the various repositories over time to use the new vanity URL. For example, some packages will use a URL of bitbucketurl.org and some will use mycoolgoimportvanity.org in their source code imports. Other than the use-case outlined above, this feature adds flexibility to the vanity server to support more than one vanity URL when used behind an ingress controller.
2021-09-10Use go embed for templates (#50)Luciano Nooijen1
Go 1.16 includes a `//go:embed` directive that obviates the need for bindata. Use `//go:embed` instead of bindata for templates used in sally. Signed-off-by: Luciano Nooijen <luciano@bytecode.nl> Co-authored-by: Abhinav Gupta <abg@uber.com>
2021-05-18Allow setting branch (#46)Jan-Philipp Benecke1
Support specifying the branch from which source will be served in the YAML configuration.
2019-03-05Support changing godoc instance (#38)Diego Bernardes1
This adds the ability to change the godoc.org instance used by Sally to link to documentation by providing a new `godoc` section in the configuration.
2019-01-03template: Bundle in binary with bindata (#36)Abhinav Gupta1
This uses go-bindata/go-bindata to bundle the template in the binary. I also realized that the handler test was now broken because we were checking the exact contents of the index page in the test. This change fixes that too.
2019-01-03Add minimal stylingAbhinav Gupta1
2016-10-27Enforce alphabetical ordering of packages in YAML config (#22)Garrett Squire1
2016-10-12Rework as HTTP server (#15)Grayson Koonce1