Commits

Doug Burke committed f7caaf6

Location of Twitter credentials (once authorized) is now set by oauth file, not hardcoded to .astrosearch/

  • Participants
  • Parent commits c5b45ad

Comments (0)

Files changed (2)

File Common.hs.in

 credentialPath :: IO FilePath
 credentialPath = do
   hdir <- getHomeDirectory
-  let dname = hdir </> ".astrosearch"
+  let dname = hdir </> "@@DIRNAME@@"
   createDirectoryIfMissing True dname
   return dname
 
 #
 # Insert Twitter OAuth tokens into Common.hs if available.
 #
+# Contents of oauth
+#    line 1 = Consumer key
+#    line 2 = Consumer secret
+#    line 3 = directory name to store credentials, relative to home directory
+#
 
 ifile=Common.hs.in
 ofile=Common.hs
 if [ -e oauth ] ; then
     oa=( $(cat oauth) )
     noa=( ${#oa[@]} )
-    if [ $noa -eq 2 ] ; then
+    if [ $noa -eq 3 ] ; then
         key=(${oa[0]})
         secret=(${oa[1]})
-        sed -e s/@@KEY@@/$key/ -e s/@@SECRET@@/$secret/ $ifile > $ofile
+        dname=(${oa[2]})
+        sed -e s/@@KEY@@/$key/ -e s/@@SECRET@@/$secret/ -e s/@@DIRNAME@@/$dname/ $ifile > $ofile
         flag=1
         #echo "Created: Common.hs"
 
     else
-        echo "WARNING: oauth does not contain 2 lines so skipping"
+        echo "WARNING: oauth does not contain 3 lines so skipping"
         cp $ifile $ofile
     fi