forked from cwtch.im/cwtch
Changes to resolve ticket #152
This commit is contained in:
parent
a94ed9eaff
commit
04b2191238
|
@ -57,7 +57,7 @@ COPY --from=tor-build-stage /usr/local/ /usr/local/
|
|||
|
||||
# Create an unprivileged tor user
|
||||
#RUN addgroup -g 19001 -S $TOR_USER && adduser -u 19001 -G $TOR_USER -S $TOR_USER
|
||||
RUN addgroup -S $TOR_USER && adduser -G $TOR_USER -S $TOR_USER && adduser -G _tor -S cwtchd
|
||||
RUN addgroup -S $TOR_USER && adduser -G $TOR_USER -S $TOR_USER && adduser -G _tor -S cwtchd && mkdir /run/tor
|
||||
|
||||
# Copy Tor configuration file
|
||||
COPY ./server/docker/torrc /etc/tor/torrc
|
||||
|
@ -69,7 +69,7 @@ COPY ./server/docker/docker-entrypoint /usr/local/bin/
|
|||
COPY --from=server-build-stage /go/src/cwtch.im/cwtch/server/app/app /usr/local/bin/cwtch_server
|
||||
|
||||
# Persist data
|
||||
VOLUME /etc/tor /var/lib/tor
|
||||
VOLUME /etc/tor /var/lib/tor /etc/cwtch
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint"]
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
cwtchserver "cwtch.im/cwtch/server"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -10,7 +11,9 @@ const (
|
|||
)
|
||||
|
||||
func main() {
|
||||
serverConfig := cwtchserver.LoadConfig(serverConfigFile)
|
||||
configDir := os.Getenv("CWTCH_CONFIG_DIR")
|
||||
|
||||
serverConfig := cwtchserver.LoadConfig(configDir + serverConfigFile)
|
||||
|
||||
server := new(cwtchserver.Server)
|
||||
log.Printf("starting cwtch server...")
|
||||
|
|
|
@ -6,7 +6,6 @@ chmod_files() { find $2 -type f -exec chmod -v $1 {} \;
|
|||
chmod_dirs() { find $2 -type d -exec chmod -v $1 {} \;
|
||||
}
|
||||
|
||||
mkdir /run/tor/
|
||||
chown ${TOR_USER}:${TOR_USER} /run/tor/
|
||||
chmod 770 /run/tor
|
||||
|
||||
|
@ -29,5 +28,3 @@ sleep 15
|
|||
#Run cwtch (or whatever the user passed)
|
||||
exec "$@"
|
||||
#$@
|
||||
|
||||
|
||||
|
|
|
@ -31,12 +31,14 @@ func (config *Config) Identity() identity.Identity {
|
|||
|
||||
// Save dumps the latest version of the config to a json file given by filename
|
||||
func (config *Config) Save(filename string) {
|
||||
log.Println("Saving config to %s", filename)
|
||||
bytes, _ := json.MarshalIndent(config, "", "\t")
|
||||
ioutil.WriteFile(filename, bytes, 0600)
|
||||
}
|
||||
|
||||
// LoadConfig loads a Config from a json file specified by filename
|
||||
func LoadConfig(filename string) Config {
|
||||
log.Printf("Loading config from %s\n", filename)
|
||||
config := Config{}
|
||||
config.MaxBufferLines = 100000
|
||||
config.ServerReporting.LogMetricsToFile = false
|
||||
|
|
Loading…
Reference in New Issue