Documentation ¶
Overview ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package for configuration of command line tool and web apps.
Index ¶
- func DBConfig() string
- func GetCnReaderHome() string
- func GetCnWebHome() string
- func GetEnvIntValue(key string, defValue int) int
- func GetPort() int
- func GetSiteDomain() string
- func PasswordProtected() bool
- func UseDatabase() bool
- type AppConfig
- func (c AppConfig) AvoidSubDomains() map[string]bool
- func (c AppConfig) CorpusDataDir() string
- func (c AppConfig) CorpusDir() string
- func (c AppConfig) DictionaryDir() string
- func (c AppConfig) GetVar(key string) string
- func (c AppConfig) IndexCorpus() (string, bool)
- func (c AppConfig) IndexDir() string
- func (c AppConfig) IndexGen() int
- type WebAppConfig
- func (c WebAppConfig) AddDirectoryToCol() bool
- func (c WebAppConfig) GetAll() map[string]string
- func (c WebAppConfig) GetFromEmail() string
- func (c WebAppConfig) GetPasswordResetURL() string
- func (c WebAppConfig) GetVar(key string) string
- func (c WebAppConfig) GetVarWithDefault(key, defaultVal string) string
- func (c WebAppConfig) NotesExtractorPattern() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBConfig ¶ added in v0.0.31
func DBConfig() string
DBConfig gets the configuration string to connect to the database
func GetCnReaderHome ¶ added in v0.0.31
func GetCnReaderHome() string
GetCnReaderHome gets the home directory of the Chinese Notes project
func GetCnWebHome ¶ added in v0.0.31
func GetCnWebHome() string
GetCnWebHome gets the home directory of the web application
func GetEnvIntValue ¶ added in v0.0.31
GetEnvIntValue gets a value from the environment
func GetPort ¶ added in v0.0.31
func GetPort() int
GetPort get environment variable for serving port
func PasswordProtected ¶ added in v0.0.31
func PasswordProtected() bool
PasswordProtected gets whether the web site is password projected.
func UseDatabase ¶ added in v0.0.31
func UseDatabase() bool
PasswordProtected gets whether the web site is password projected.
Types ¶
type AppConfig ¶ added in v0.0.25
type AppConfig struct { // The top level directory for the project ProjectHome string // A map of project configuration variables ConfigVars map[string]string // A list of files to read the lexical units in the dictionary from LUFileNames []string }
AppConfig holds application configuration data that is general to the API
These variables are common to API and web app usage, especially loading dictionary files.
func InitConfig ¶ added in v0.0.24
func InitConfig() AppConfig
InitConfig sets application configuration data
func (AppConfig) AvoidSubDomains ¶ added in v0.0.25
Default: empty
func (AppConfig) CorpusDataDir ¶ added in v0.0.25
CorpusDataDir returns the directory where the corpus metadata is stored
func (AppConfig) CorpusDir ¶ added in v0.0.25
CorpusDir gets the directory where the raw corpus text files are read from
func (AppConfig) DictionaryDir ¶ added in v0.0.25
DictionaryDir gets the name of the directory containing the dictionary files
func (AppConfig) IndexCorpus ¶ added in v0.0.105
IndexCorpus gets the name of the corpus to test the term frequency index in Firestore.
type WebAppConfig ¶ added in v0.0.31
type WebAppConfig struct { // A map of project configuration variables ConfigVars map[string]string }
WebAppConfig holds application configuration data that is specific to the web app
func InitWeb ¶ added in v0.0.31
func InitWeb(configFile io.Reader) WebAppConfig
InitWeb loads the WebAppConfig data. If an error occurs, default values are used
func (WebAppConfig) AddDirectoryToCol ¶ added in v0.0.115
func (c WebAppConfig) AddDirectoryToCol() bool
AddDirectoryToCol gets whether to add a directory prefix to collection names in full text search
func (WebAppConfig) GetAll ¶ added in v0.0.31
func (c WebAppConfig) GetAll() map[string]string
GetAll gets all configuration variables
func (WebAppConfig) GetFromEmail ¶ added in v0.0.31
func (c WebAppConfig) GetFromEmail() string
GetFromEmail gets the environment or config variable for sending email from
func (WebAppConfig) GetPasswordResetURL ¶ added in v0.0.31
func (c WebAppConfig) GetPasswordResetURL() string
GetPasswordResetURL gets the password reset URL for inclusion in email
func (WebAppConfig) GetVar ¶ added in v0.0.31
func (c WebAppConfig) GetVar(key string) string
GetVar gets a configuration variable value, default empty string
func (WebAppConfig) GetVarWithDefault ¶ added in v0.0.31
func (c WebAppConfig) GetVarWithDefault(key, defaultVal string) string
GetVarWithDefault gets a configuration value with given default
func (WebAppConfig) NotesExtractorPattern ¶ added in v0.0.92
func (c WebAppConfig) NotesExtractorPattern() string
NotesExtractorPattern gets regular expression for extracting multilingual equivalents in the notes