• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang config.String函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/drone/config.String函数的典型用法代码示例。如果您正苦于以下问题:Golang String函数的具体用法?Golang String怎么用?Golang String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了String函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Register

package gogs

import (
	"github.com/drone/config"
	"github.com/drone/drone/plugin/remote"
)

var (
	gogsUrl    = config.String("gogs-url", "")
	gogsSecret = config.String("gogs-secret", "")
)

// Registers the Gogs plugin using the default
// settings from the config file or environment
// variables.
func Register() {
	if len(*gogsUrl) == 0 {
		return
	}
	remote.Register(
		New(*gogsUrl, *gogsSecret),
	)
}
开发者ID:carnivalmobile,项目名称:drone,代码行数:23,代码来源:register.go


示例2: Register

package bitbucket

import (
	"github.com/drone/config"
	"github.com/quartethealth/drone/plugin/remote"
)

var (
	// Bitbucket cloud configuration details
	bitbucketClient = config.String("bitbucket-client", "")
	bitbucketSecret = config.String("bitbucket-secret", "")
	bitbucketOpen   = config.Bool("bitbucket-open", false)
)

// Registers the Bitbucket plugin using the default
// settings from the config file or environment
// variables.
func Register() {
	if len(*bitbucketClient) == 0 || len(*bitbucketSecret) == 0 {
		return
	}
	remote.Register(
		NewDefault(*bitbucketClient, *bitbucketSecret, *bitbucketOpen),
	)
}
开发者ID:quartethealth,项目名称:drone,代码行数:25,代码来源:register.go


示例3:

const (
	DockerTLSWarning = `WARINING: Docker TLS cert or key not given, this may cause a build errors`
)

var (
	// commit sha for the current build, set by
	// the compile process.
	version  string = "0.3-dev"
	revision string
)

var (
	// Database driver configuration. Defaults to sqlite
	// when no database configuration specified.
	datasource = config.String("database-datasource", "drone.sqlite")
	driver     = config.String("database-driver", "sqlite3")

	// HTTP Server settings.
	port   = config.String("server-port", ":8000")
	sslcrt = config.String("server-ssl-cert", "")
	sslkey = config.String("server-ssl-key", "")

	// Enable self-registration. When false, the system admin
	// must grant user access.
	open = config.Bool("registration-open", false)

	workers *pool.Pool
	worker  *director.Director
	pub     *pubsub.PubSub
开发者ID:carnivalmobile,项目名称:drone,代码行数:29,代码来源:main.go


示例4: Register

package github

import (
	"github.com/drone/config"
	"github.com/drone/drone/plugin/remote"
)

var (
	// GitHub cloud configuration details
	githubClient = config.String("github-client", "")
	githubSecret = config.String("github-secret", "")

	// GitHub Enterprise configuration details
	githubEnterpriseURL     = config.String("github-enterprise-url", "")
	githubEnterpriseAPI     = config.String("github-enterprise-api", "")
	githubEnterpriseClient  = config.String("github-enterprise-client", "")
	githubEnterpriseSecret  = config.String("github-enterprise-secret", "")
	githubEnterprisePrivate = config.Bool("github-enterprise-private-mode", true)
)

// Registers the GitHub plugins using the default
// settings from the config file or environment
// variables.
func Register() {
	registerGitHub()
	registerGitHubEnterprise()
}

// registers the GitHub (github.com) plugin
func registerGitHub() {
	if len(*githubClient) == 0 || len(*githubSecret) == 0 {
开发者ID:grupawp,项目名称:drone,代码行数:31,代码来源:register.go


示例5: GetUser

	"code.google.com/p/go.net/context"
	"github.com/armab/drone/server/datastore"
	"github.com/armab/drone/shared/httputil"
	"github.com/armab/drone/shared/model"
	"github.com/dgrijalva/jwt-go"
	"github.com/drone/config"
	"github.com/gorilla/securecookie"
)

// random key used to create jwt if none
// provided in the configuration.
var random = securecookie.GenerateRandomKey(32)

var (
	secret  = config.String("session-secret", string(random))
	expires = config.Duration("session-expires", time.Hour*72)
)

// GetUser gets the currently authenticated user for the
// http.Request. The user details will be stored as either
// a simple API token or JWT bearer token.
func GetUser(c context.Context, r *http.Request) *model.User {
	switch {
	case r.Header.Get("Authorization") != "":
		return getUserBearer(c, r)
	case r.FormValue("access_token") != "":
		return getUserToken(c, r)
	default:
		return nil
	}
开发者ID:armab,项目名称:drone,代码行数:30,代码来源:session.go


示例6: formatRsaKey

const rsaKeyPrefix = "-----BEGIN RSA PRIVATE KEY-----"

func formatRsaKey(key string) string {
	// If this came from the config file it should be formatted right
	if !strings.HasPrefix(key, rsaKeyPrefix) {
		// Replace spaces in the key with newlines. This makes it
		// easier to pass the key in an environment variable
		key = strings.Replace(key, " ", "\n", -1)
		key = fmt.Sprintf("%s\n%s\n-----END RSA PRIVATE KEY-----", rsaKeyPrefix, key)
	}

	return key
}

var (
	googleServiceEmail      = config.String("google-service-email", "")
	googleServicePrivateKey = config.String("google-service-private-key", "")
	googleServiceUser       = config.String("google-service-user", "")
)

// InitializeGoogleGroup checks that our Google service account is able to fetch
// group membership for a user (It users the `google-service-user` to test).
func InitializeGoogleGroup() error {
	*googleServicePrivateKey = formatRsaKey(*googleServicePrivateKey)

	groups, err := GetUserGroups(*googleServiceUser)
	if err != nil {
		return fmt.Errorf("Google groups doesn't work: %s", err)
	}
	fmt.Printf("google groups test: passed (user %s is a member of %#v)\n",
		*googleServiceUser, groups)
开发者ID:nonbeing,项目名称:awsconsoleauth,代码行数:31,代码来源:google_group.go


示例7: Register

package gitlab

import (
	"github.com/drone/config"
	"github.com/drone/drone/plugin/remote"
)

var (
	gitlabURL        = config.String("gitlab-url", "")
	gitlabSkipVerify = config.Bool("gitlab-skip-verify", false)
	gitlabOpen       = config.Bool("gitlab-open", false)

	gitlabClient = config.String("gitlab-client", "")
	gitlabSecret = config.String("gitlab-secret", "")
)

// Registers the Gitlab plugin using the default
// settings from the config file or environment
// variables.
func Register() {
	if len(*gitlabURL) == 0 {
		return
	}
	remote.Register(
		New(
			*gitlabURL,
			*gitlabSkipVerify,
			*gitlabOpen,
			*gitlabClient,
			*gitlabSecret,
		),
开发者ID:zankard,项目名称:drone,代码行数:31,代码来源:register.go


示例8:

	npm publish %s
	[ -n ${_NPM_PACKAGE_TAG} ] && npm tag ${_NPM_PACKAGE_NAME} ${_NPM_PACKAGE_TAG}
else
	echo "skipping publish, package ${_NPM_PACKAGE_NAME} already published"
fi
unset _NPM_PACKAGE_NAME
unset _NPM_PACKAGE_TAG
`

const (
	CmdAlwaysAuth  = "npm set always-auth true"
	CmdSetRegistry = "npm config set registry %s"
)

var (
	DefaultUser  = config.String("npm-user", "")
	DefaultPass  = config.String("npm-pass", "")
	DefaultEmail = config.String("npm-email", "")
)

type NPM struct {
	// The Email address used by NPM to connect
	// and publish to a repository
	Email string `yaml:"email,omitempty"`

	// The Username used by NPM to connect
	// and publish to a repository
	Username string `yaml:"username,omitempty"`

	// The Password used by NPM to connect
	// and publish to a repository
开发者ID:quartethealth,项目名称:drone,代码行数:31,代码来源:npm.go


示例9:

	NotifyNever  = "never"  // never send email notifications
	NotifyAuthor = "author" // only send email notifications to the author

	NotifyTrue  = "true"  // alias for NotifyTrue
	NotifyFalse = "false" // alias for NotifyFalse
	NotifyOn    = "on"    // alias for NotifyTrue
	NotifyOff   = "off"   // alias for NotifyFalse
	NotifyBlame = "blame" // alias for NotifyAuthor
)

const (
	Subject = "[%s] %s/%s (%s - %s)"
)

var (
	DefaultHost = config.String("smtp-host", "")
	DefaultPort = config.String("smtp-port", "")
	DefaultFrom = config.String("smtp-from", "")
	DefaultUser = config.String("smtp-user", "")
	DefaultPass = config.String("smtp-pass", "")
)

type Email struct {
	Recipients []string `yaml:"recipients"`
	Success    string   `yaml:"on_success"`
	Failure    string   `yaml:"on_failure"`

	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	From     string `yaml:"from"`
	Username string `yaml:"username"`
开发者ID:grupawp,项目名称:drone,代码行数:31,代码来源:email.go


示例10: Register

package stash

import (
	"github.com/drone/config"
	"github.com/drone/drone/plugin/remote"
)

var (
	// Stash configuration details
	stashURL        = config.String("stash-url", "")
	stashAPI        = config.String("stash-api", "")
	stashSecret     = config.String("stash-secret", "")
	stashPrivateKey = config.String("stash-private-key", "")
	stashHook       = config.String("stash-hook", "")
	stashOpen       = config.Bool("stash-open", false)
)

// Registers the Stash plugin using the default
// settings from the config file or environment
// variables
func Register() {
	if len(*stashURL) == 0 ||
		len(*stashAPI) == 0 ||
		len(*stashSecret) == 0 ||
		len(*stashPrivateKey) == 0 ||
		len(*stashHook) == 0 {
		return
	}
	remote.Register(
		New(
			*stashURL,
开发者ID:reinbach,项目名称:drone,代码行数:31,代码来源:register.go


示例11:

_NPM_PACKAGE_NAME=$(cd %s && npm list | head -n 1 | cut -d ' ' -f1)
_NPM_PACKAGE_TAG="%s"
_EXISTING_NPM_PKG=$(npm info ${_NPM_PACKAGE_NAME} 2> /dev/null || true)
if [ "${_EXISTING_NPM_PKG}" = "" ] || [ "${_EXISTING_NPM_PKG}" = "undefined" ]
then
	npm publish %s
else
	echo "skipping publish, package ${_NPM_PACKAGE_NAME} already published"
fi
unset _NPM_PACKAGE_NAME
unset _NPM_PACKAGE_TAG
unset _EXISTING_NPM_PKG
`

var (
	DefaultToken    = config.String("npm-token", "")
	DefaultRegistry = config.String("npm-registry", "registry.npmjs.org")
)

type NPM struct {
	// The Token used by NPM to connect
	// and publish to a repository
	Token string `yaml:"token,omitempty"`

	// The registry URL of custom npm repository
	Registry string `yaml:"registry,omitempty"`

	// A folder containing the package.json file
	Folder string `yaml:"folder,omitempty"`

	// Registers the published package with the given tag
开发者ID:Clever,项目名称:drone,代码行数:31,代码来源:npm.go


示例12: main

	//"strings"

	"github.com/drone/config"

	"github.com/tuanp/autoapi/middleware"
	"github.com/tuanp/autoapi/router"
	"github.com/tuanp/autoapi/system"
	"github.com/tuanp/autoapi/util/log"

	//"github.com/RainingClouds/yaag/yaag"

	gojiMiddleware "github.com/zenazn/goji/web/middleware"
)

var (
	databaseUrl      = config.String("database-url", "mongodb://pat109:[email protected]:41160/voa")
	databaseName     = config.String("database-name", "voa")
	databaseUsername = config.String("database-username", "drone.sqlite")
	databasePassword = config.String("database-password", "drone.sqlite")

	// HTTP Server settings.
	port   = config.String("server-port", ":8000")
	sslcrt = config.String("server-ssl-cert", "")
	sslkey = config.String("server-ssl-key", "")
)

func main() {
	log.SetPriority(log.LOG_NOTICE)

	var conf string
	flag.StringVar(&conf, "config", "", "")
开发者ID:golangpat,项目名称:autoapi,代码行数:31,代码来源:main.go


示例13: New

	"github.com/armab/drone/plugin/remote/github/oauth"
	"github.com/armab/drone/shared/httputil"
	"github.com/armab/drone/shared/model"
	"github.com/drone/config"
	"github.com/drone/go-github/github"
)

const (
	DefaultAPI   = "https://api.github.com/"
	DefaultURL   = "https://github.com"
	DefaultScope = "repo,repo:status,user:email"
)

var (
	BuildConfigFile = config.String("server-file", ".drone.yml")
)

type GitHub struct {
	URL        string
	API        string
	Client     string
	Secret     string
	Private    bool
	SkipVerify bool
	Orgs       []string
	Open       bool
}

func New(url, api, client, secret string, private, skipVerify bool, orgs []string, open bool) *GitHub {
	var github = GitHub{
开发者ID:armab,项目名称:drone,代码行数:30,代码来源:github.go


示例14: updateGoogleJWTSigningKeys

package awsconsoleauth

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"time"

	"github.com/dgrijalva/jwt-go"
	"github.com/drone/config"
	"golang.org/x/oauth2"
	"golang.org/x/oauth2/google"
)

var googleClientID = config.String("google-client-id", "")
var googleClientSecret = config.String("google-client-secret", "")
var googleDomain = config.String("google-domain", "")

var googleOauthConfig = &oauth2.Config{
	Scopes:   []string{"email"},
	Endpoint: google.Endpoint,
}

var googleJWTSigningKeys = map[string]interface{}{}

func updateGoogleJWTSigningKeys() error {
	// Fetch the google keys for oauth
	googleCertsResponse, err := http.Get("https://www.googleapis.com/oauth2/v1/certs")
	if err != nil {
		return err
开发者ID:nonbeing,项目名称:awsconsoleauth,代码行数:31,代码来源:google_login.go


示例15: InitializeAWS

package awsconsoleauth

import (
	"encoding/json"
	"fmt"
	"net/http"
	"net/url"
	"strings"
	"time"

	"github.com/crowdmob/goamz/aws"
	"github.com/crowdmob/goamz/sts"
	"github.com/drone/config"
)

var awsRegion = config.String("aws-region", "")

var awsAccessKey = config.String("aws-access-key-id", "")
var awsSecretKey = config.String("aws-secret-access-key", "")

var awsAuth aws.Auth

// InitializeAWS sets up access to the AWS Simple Token Service
func InitializeAWS() error {
	if *awsRegion == "" {
		*awsRegion = aws.InstanceRegion()
		if *awsRegion == "unknown" {
			*awsRegion = "us-east-1"
		}
	}
开发者ID:nonbeing,项目名称:awsconsoleauth,代码行数:30,代码来源:aws.go



注:本文中的github.com/drone/config.String函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang parser.Node类代码示例发布时间:2022-05-23
下一篇:
Golang git.Repository类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap