...

Source file src/github.com/prometheus/alertmanager/asset/asset.go

Documentation: github.com/prometheus/alertmanager/asset

     1  // Copyright 2018 The Prometheus Authors
     2  // Licensed under the Apache License, Version 2.0 (the "License");
     3  // you may not use this file except in compliance with the License.
     4  // You may obtain a copy of the License at
     5  //
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  //go:build dev
    15  // +build dev
    16  
    17  package asset
    18  
    19  import (
    20  	"net/http"
    21  	"os"
    22  	"strings"
    23  
    24  	"github.com/shurcooL/httpfs/filter"
    25  	"github.com/shurcooL/httpfs/union"
    26  )
    27  
    28  var static http.FileSystem = filter.Keep(
    29  	http.Dir("../ui/app"),
    30  	func(path string, fi os.FileInfo) bool {
    31  		return path == "/" ||
    32  			path == "/script.js" ||
    33  			path == "/index.html" ||
    34  			path == "/favicon.ico" ||
    35  			strings.HasPrefix(path, "/lib")
    36  	},
    37  )
    38  
    39  var templates http.FileSystem = filter.Keep(
    40  	http.Dir("../template"),
    41  	func(path string, fi os.FileInfo) bool {
    42  		return path == "/" || path == "/default.tmpl" || path == "/email.tmpl"
    43  	},
    44  )
    45  
    46  // Assets contains the project's assets.
    47  var Assets http.FileSystem = union.New(map[string]http.FileSystem{
    48  	"/templates": templates,
    49  	"/static":    static,
    50  })
    51  

View as plain text