env

package
v0.0.0-...-ed8ca81 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppID

func AppID() (string, error)

AppID returns the application ID for the current SCM provider.

func AppKey

func AppKey() string

AppKey returns path to the file with .pem private key. For GitHub apps a key must be generated on the App's settings page and saved into a file.

func AppName

func AppName() string

AppName returns the name of the QuickFeed app on GitHub.

func CertFile

func CertFile() string

CertFile returns the full path to the certificate file. To specify a different file, use the QUICKFEED_CERT_FILE environment variable.

func CertPath

func CertPath() string

CertPath returns the full path to the directory containing the certificates. If QUICKFEED_CERT_PATH is not set, the default path $QUICKFEED/internal/config/certs is used.

func ClientID

func ClientID() (string, error)

ClientID returns the client ID for the current SCM provider.

func ClientSecret

func ClientSecret() (string, error)

ClientSecret returns the client secret for the current SCM provider.

func DatabasePath

func DatabasePath() string

DatabasePath returns the path to the database file.

func Domain

func Domain() string

Domain returns the domain name where quickfeed will be served. Domain should not include the server name.

func ExistsError

func ExistsError(filename string) error

func GetAccessToken

func GetAccessToken() (string, error)

func HasAppID

func HasAppID() bool

HasAppID returns true if the environment specifies an APP_ID.

func IsLocal

func IsLocal(domain string) bool

func KeyFile

func KeyFile() string

KeyFile returns the full path to the certificate key file. To specify a different key, use the QUICKFEED_KEY_FILE environment variable.

func Load

func Load(filename string) error

Load loads environment variables from the given file, or from $QUICKFEED/.env. The variable's values are expanded with existing variables from the environment. It will not override a variable that already exists in the environment.

func MissingError

func MissingError(filename string) error

func Prepared

func Prepared(filename string) error

Prepared returns nil if the given env file exists and the corresponding backup file does not. Otherwise, it returns an error.

If the env file does not exist, a MissingError returned. QuickFeed requires the env file to load (some) existing environment variables, even when creating a new GitHub app, and overwriting some environment variables. If the backup file exists, an ExistsError is returned. This is to avoid that QuickFeed overwrites an existing backup file.

func PublicDir

func PublicDir() string

PublicDir returns the path to the public directory.

func PublicEnv

func PublicEnv(envFile string) string

PublicEnv returns the path $QUICKFEED/public/{envFile}.

func RepositoryPath

func RepositoryPath() string

func Root

func Root() string

Root returns the root directory as defined by $QUICKFEED or sets it relative to the quickfeed module's root. This function will panic if called when the working directory is not within the quickfeed repository. In this case, the environment variable $QUICKFEED must be set manually.

func RootEnv

func RootEnv(envFile string) string

RootEnv returns the path $QUICKFEED/{envFile}.

func Save

func Save(filename string, env map[string]string) error

Save writes the given environment variables to the given file, replacing or leaving behind existing variables.

If the file exists, it will be updated, but leaving a backup file. If a backup already exists it will be removed first.

func ScmProvider

func ScmProvider() string

ScmProvider returns the current SCM provider supported by this backend.

func SetFakeProvider

func SetFakeProvider(t *testing.T)

SetFakeProvider sets the provider to fake. This is only for testing. The t argument is added as a reminder that this is only for testing.

func TestdataPath

func TestdataPath() string

TestdataPath returns the path to the testdata/courses directory.

func Whitelist

func Whitelist() ([]string, error)

WhiteList returns a list of domains that the server will create certificates for.

Types

This section is empty.

Jump to

Keyboard shortcuts

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