Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relative file locations #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eth-proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
def on_shutdown(f):
'''Clean environment properly'''
log.info("Shutting down proxy...")
if os.path.isfile('eth-proxy.pid'):
os.remove('eth-proxy.pid')
if os.path.isfile(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid')):
os.remove(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid'))
f.is_reconnecting = False # Don't let stratum factory to reconnect again

# Support main connection
Expand Down Expand Up @@ -166,7 +166,7 @@ def main():
log.warning("-----------------------------------------------------------------------")

if __name__ == '__main__':
fp = file("eth-proxy.pid", 'w')
fp = file(os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.pid'), 'w')
fp.write(str(os.getpid()))
fp.close()
main()
Expand Down
3 changes: 2 additions & 1 deletion stratum/config_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
This is example configuration for Stratum server.
Please rename it to config.py and fill correct values.
'''
import os

# ******************** GENERAL SETTINGS ***************

# Enable some verbose debug (logging requests and responses).
DEBUG = False

# Destination for application logs, files rotated once per day.
LOGDIR = 'log/'
LOGDIR = os.path.join(os.path.dirname(__file__), '../log/')

# Main application log file.
LOGFILE = None
Expand Down
6 changes: 4 additions & 2 deletions stratum/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def read_values(cfg):

import config_default

if os.path.isfile('eth-proxy.conf'):
config = open('eth-proxy.conf','r').readlines()
conf_file = os.path.join(os.path.dirname(__file__), '../', 'eth-proxy.conf')

if os.path.isfile(conf_file):
config = open(conf_file,'r').readlines()
else:
# Custom config not presented, but we can still use defaults
config = None
Expand Down